Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
3949674
Code Quality: Remove `null` from `validate_another_blog_signup()` ret…
mukeshpanchal27 Nov 3, 2026
d8ddbb1
Merge branch 'trunk' into fix/validate-another-blog-signup-return-type
mukeshpanchal27 Nov 4, 2026
3041f54
Code Quality: Document arrays in the `plugins_api_result` filter.
mukeshpanchal27 Nov 4, 2026
8c42ca1
Code Quality: Remove `WP_Error` from `_fix_attachment_links()` return…
mukeshpanchal27 Nov 4, 2026
41ba355
Code Quality: Remove `array` from `get_preferred_from_update_core()` …
mukeshpanchal27 Nov 4, 2026
6349af4
Code Quality: Correct the `$tag_list` type in the `the_tags` filter.
mukeshpanchal27 Nov 4, 2026
37dc5ce
Code Quality: Accept `null` in the `_make_cat_compat()` parameter type.
mukeshpanchal27 Nov 4, 2026
5e739c4
Code Quality: Remove `false` from `recovery_mode_hash()` return type.
mukeshpanchal27 Nov 4, 2026
be0e86b
Code Quality: Document `false` in the `wp_code_editor_settings` filter.
mukeshpanchal27 Nov 4, 2026
ec8f929
Code Quality: Correct the `get_post_gallery()` return and filter types.
mukeshpanchal27 Nov 4, 2026
d3760b9
Code Quality: Document `false` in the `wp_mime_type_icon` filter.
mukeshpanchal27 Nov 4, 2026
8b55de8
Code Quality: Remove `false` from `_set_preview()` return type.
mukeshpanchal27 Nov 4, 2026
beb353a
Code Quality: Correct the `get_term_to_edit()` return type.
mukeshpanchal27 Nov 4, 2026
c95d168
Code Quality: Document `WP_Error` in the `allow_password_reset` filter.
mukeshpanchal27 Nov 4, 2026
a6d0682
Build/Test Tools: Remove the `return.unusedType` PHPStan baseline.
mukeshpanchal27 Nov 4, 2026
f378672
Merge branch 'fix/validate-another-blog-signup-return-type' of https:…
mukeshpanchal27 Nov 4, 2026
fc5d8c1
Code Quality: Fix docblock continuation alignment.
mukeshpanchal27 Nov 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ includes:
- tests/phpstan/baselines/property.notFound.neon
- tests/phpstan/baselines/property.private.neon
- tests/phpstan/baselines/return.type.neon
- tests/phpstan/baselines/return.unusedType.neon
- tests/phpstan/baselines/varTag.noVariable.neon
- tests/phpstan/baselines/variable.undefined.neon
# phpstan:baselines end
Expand Down Expand Up @@ -116,6 +115,18 @@ parameters:
path: src/wp-includes/compat.php
reportUnmatched: false

# Level 4:
# wp_imagecreatetruecolor() returns whatever imagecreatetruecolor() returns: a resource on PHP 7.4 and a
# GdImage instance on PHP 8.0+. Its docblock lists both, which is correct for WP's 7.4+ range. Because
# `phpVersion.min` is 70400, PHPStan reads the function from its pre-8.0 map, sees only a resource, and
# reports GdImage as unused. Removing GdImage would make the docblock wrong on every PHP 8 install.
# `reportUnmatched: false` so this entry lapses quietly if PHPStan stops reporting it.
-
message: '#^Function wp_imagecreatetruecolor\(\) never returns GdImage so it can be removed from the return type\.$#'
identifier: return.unusedType
path: src/wp-includes/media.php
reportUnmatched: false

# Level 5:
# substr_compare()'s $length has always accepted null, meaning "compare the full length". PHP 7.4 spelled
# that `int $length = null`, where the null default makes the parameter implicitly nullable, and PHP 8.0
Expand Down
6 changes: 3 additions & 3 deletions src/wp-admin/includes/plugin-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ function plugins_api( $action, $args = array() ) {
*
* @since 2.7.0
*
* @param object|WP_Error $res Response object or WP_Error.
* @param string $action The type of information being requested from the Plugin Installation API.
* @param object $args Plugin API arguments.
* @param object|array|WP_Error $res Response object or array, or WP_Error on failure.
* @param string $action The type of information being requested from the Plugin Installation API.
* @param object $args Plugin API arguments.
*/
return apply_filters( 'plugins_api_result', $res, $action, $args );
}
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ function update_meta( $meta_id, $meta_key, $meta_value ) {
* @access private
*
* @param int|WP_Post $post Post ID or post object.
* @return void|int|WP_Error Void if nothing fixed. 0 or WP_Error on update failure. The post ID on update success.
* @return void|int Void if nothing fixed. 0 on update failure. The post ID on update success.
*/
function _fix_attachment_links( $post ) {
$post = get_post( $post, ARRAY_A );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* @since 2.7.0
*
* @return object|array|false The response from the API on success, false on failure.
* @return object|false The response from the API on success, false on failure.
*/
function get_preferred_from_update_core() {
$updates = get_core_updates();
Expand Down
11 changes: 6 additions & 5 deletions src/wp-includes/category-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1224,11 +1224,12 @@ function get_the_tag_list( $before = '', $sep = '', $after = '', $post_id = 0 )
*
* @since 2.3.0
*
* @param string $tag_list List of tags.
* @param string $before String to use before the tags.
* @param string $sep String to use between the tags.
* @param string $after String to use after the tags.
* @param int $post_id Post ID.
* @param string|false|WP_Error $tag_list A list of tags on success, false if there are no terms,
* WP_Error on failure.
* @param string $before String to use before the tags.
* @param string $sep String to use between the tags.
* @param string $after String to use after the tags.
* @param int $post_id Post ID.
*/
return apply_filters( 'the_tags', $tag_list, $before, $sep, $after, $post_id );
}
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ function clean_category_cache( $id ) {
* @since 4.4.0 The `$category` parameter now also accepts a WP_Term object.
* @access private
*
* @param array|object|WP_Term $category Category row object or array.
* @param array|object|WP_Term|null $category Category row object or array. Null is left unchanged.
*/
function _make_cat_compat( &$category ) {
if ( is_object( $category ) && ! is_wp_error( $category ) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-recovery-mode-cookie-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private function generate_cookie() {
* @since 5.2.0
*
* @param string $data Data to hash.
* @return string|false The hashed $data, or false on failure.
* @return string The hashed $data.
*/
private function recovery_mode_hash( $data ) {
$default_keys = array_unique(
Expand Down
6 changes: 3 additions & 3 deletions src/wp-includes/general-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -4760,9 +4760,9 @@ function wp_get_code_editor_settings( $args ) {
*
* @since 4.9.0
*
* @param array $settings The array of settings passed to the code editor.
* A falsey value disables the editor.
* @param array $args {
* @param array|false $settings The array of settings passed to the code editor.
* A falsey value disables the editor.
* @param array $args {
* Args passed when calling `get_code_editor_settings()`.
*
* @type string $type The MIME type of the file to be edited.
Expand Down
11 changes: 7 additions & 4 deletions src/wp-includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -5587,7 +5587,9 @@ function get_post_galleries( $post, $html = true ) {
*
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
* @param bool $html Optional. Whether to return HTML or data. Default is true.
* @return string|array Gallery data and srcs parsed from the expanded shortcode.
* @return string|array|false Gallery HTML or an array of gallery data and srcs parsed from
* the expanded shortcode, depending on `$html`. False if the post has
* no gallery.
*/
function get_post_gallery( $post = 0, $html = true ) {
$galleries = get_post_galleries( $post, $html );
Expand All @@ -5598,9 +5600,10 @@ function get_post_gallery( $post = 0, $html = true ) {
*
* @since 3.6.0
*
* @param array $gallery The first-found post gallery.
* @param int|WP_Post $post Post ID or object.
* @param array $galleries Associative array of all found post galleries.
* @param string|array|false $gallery The first-found post gallery, or false if the post has no gallery.
* An HTML string when `$html` is true, otherwise an array.
* @param int|WP_Post $post Post ID or object.
* @param array $galleries Associative array of all found post galleries.
*/
return apply_filters( 'get_post_gallery', $gallery, $post, $galleries );
}
Expand Down
8 changes: 4 additions & 4 deletions src/wp-includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -7773,10 +7773,10 @@ function wp_mime_type_icon( $mime = 0, $preferred_ext = '.png' ) {
*
* @since 2.1.0
*
* @param string $icon Path to the mime type icon.
* @param string $mime Mime type.
* @param int $post_id Attachment ID. Will equal 0 if the function passed
* the mime type.
* @param string|false $icon Path to the mime type icon, or false if no icon was found.
* @param string $mime Mime type.
* @param int $post_id Attachment ID. Will equal 0 if the function passed
* the mime type.
*/
return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id );
}
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/revision.php
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ function wp_revisions_to_keep( $post ) {
* @access private
*
* @param WP_Post $post
* @return WP_Post|false
* @return WP_Post
*/
function _set_preview( $post ) {
if ( ! is_object( $post ) ) {
Expand Down
3 changes: 2 additions & 1 deletion src/wp-includes/taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,8 @@ function get_term_field( $field, $term, $taxonomy = '', $context = 'display' ) {
*
* @param int|object $id Term ID or object.
* @param string $taxonomy Taxonomy name.
* @return string|int|null|WP_Error Will return empty string if $term is not an object.
* @return WP_Term|string|WP_Error The term sanitized for editing, WP_Error if the taxonomy does not exist,
* or an empty string if the term does not exist.
*/
function get_term_to_edit( $id, $taxonomy ) {
$term = get_term( $id, $taxonomy );
Expand Down
5 changes: 3 additions & 2 deletions src/wp-includes/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -5341,8 +5341,9 @@ function wp_is_password_reset_allowed_for_user( $user ) {
*
* @since 2.7.0
*
* @param bool $allow Whether to allow the password to be reset. Default true.
* @param int $user_id The ID of the user attempting to reset a password.
* @param bool|WP_Error $allow Whether to allow the password to be reset, or a WP_Error to explain
* why it is not allowed. Default true.
* @param int $user_id The ID of the user attempting to reset a password.
*/
return apply_filters( 'allow_password_reset', $allow, $user->ID );
}
4 changes: 2 additions & 2 deletions src/wp-signup.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
* @global string $domain The new site's domain.
* @global string $path The new site's path.
*
* @return null|bool True if site signup was validated, false on error.
* The function halts all execution if the user is not logged in.
* @return bool True if site signup was validated, false on error.
* The function halts all execution if the user is not logged in.
*/
function validate_another_blog_signup() {
global $blogname, $blog_title, $errors, $domain, $path;
Expand Down
15 changes: 0 additions & 15 deletions tests/phpstan/baselines/property.nonObject.neon
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,6 @@ parameters:
identifier: property.nonObject
count: 1
path: ../../../src/wp-admin/includes/class-theme-upgrader.php
-
message: '#^Cannot access property \$current on array\|object\.$#'
identifier: property.nonObject
count: 3
path: ../../../src/wp-admin/includes/class-wp-automatic-updater.php
-
message: '#^Cannot access property \$response on array\|object\.$#'
identifier: property.nonObject
count: 1
path: ../../../src/wp-admin/includes/class-wp-automatic-updater.php
-
message: '#^Cannot access property \$version on array\|object\.$#'
identifier: property.nonObject
count: 1
path: ../../../src/wp-admin/includes/class-wp-automatic-updater.php
-
message: '#^Cannot access property \$info on array\|object\.$#'
identifier: property.nonObject
Expand Down
100 changes: 0 additions & 100 deletions tests/phpstan/baselines/return.unusedType.neon

This file was deleted.

Loading