Make WordPress Core

Changeset 62529 for trunk/composer.json


Ignore:
Timestamp:
06/18/2026 11:23:35 PM (2 months ago)
Author:
westonruter
Message:

Docs: Clarify return value semantics of wpdb query methods.

This eliminates over 400 PHPStan errors from the core codebase.

  • Clarify the inline documentation for the four wpdb query methods — get_results(), get_row(), get_col(), and get_var().
  • Add @phpstan-return conditional types that mirror each method's runtime dispatch on $query and $output.
  • Add @phpstan-param tags narrowing $output to the documented constants.
  • Document that get_var() returns null both on failure and when the matched cell value is an empty string, directing consumers to $this->last_error to distinguish the two cases.
  • Tighten the @return in get_results() from array|object|null to array|null, since the method never returns a bare stdClass; the object was a copy/paste artifact from get_row().
  • Fix a deprecated use of null as an array offset (PHP 8.5) in the OBJECT_K branch when a row's first column is SQL NULL.
  • Gather get_col() data as a true list.
  • Suggest ext-mysqli in composer.json, which wpdb requires at runtime.

Developed in https://github.com/WordPress/wordpress-develop/pull/11855.

Props apermo, westonruter.
See #30257, #64898.
Fixes #65261.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/composer.json

    r62495 r62529  
    1717        },
    1818        "suggest": {
    19                 "ext-dom": "*"
     19                "ext-dom": "*",
     20                "ext-mysqli": "*"
    2021        },
    2122        "require-dev": {
Note: See TracChangeset for help on using the changeset viewer.