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.