Skip to content

Add @phpstan-assert-if-true to is_wp_error()#11095

Closed
westonruter wants to merge 1 commit intoWordPress:trunkfrom
westonruter:add/is-wp-error-return-type
Closed

Add @phpstan-assert-if-true to is_wp_error()#11095
westonruter wants to merge 1 commit intoWordPress:trunkfrom
westonruter:add/is-wp-error-return-type

Conversation

@westonruter
Copy link
Member

This reduces the number of PHPStan errors at level 7 from 14,271 to 13,233 (-1,038 or -7.27%). See error report diff.

Trac ticket: https://core.trac.wordpress.org/ticket/64238

Use of AI Tools

n/a


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props westonruter.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

pento pushed a commit that referenced this pull request Feb 28, 2026
This ensures PHPStan is aware that passing a `WP_Error` instance to `is_wp_error()` will cause the function to return `true`. This reduces the total number of PHPStan errors at rule level 7 from 14,271 to 13,233 (-1,038 or -7.27%). 

Developed in #11095

See #64238.


git-svn-id: https://develop.svn.wordpress.org/trunk@61774 602fd350-edb4-49c9-b593-d223f7449a82
@westonruter
Copy link
Member Author

Committed in r61774 (b00dde1)

markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Feb 28, 2026
This ensures PHPStan is aware that passing a `WP_Error` instance to `is_wp_error()` will cause the function to return `true`. This reduces the total number of PHPStan errors at rule level 7 from 14,271 to 13,233 (-1,038 or -7.27%). 

Developed in WordPress/wordpress-develop#11095

See #64238.

Built from https://develop.svn.wordpress.org/trunk@61774


git-svn-id: http://core.svn.wordpress.org/trunk@61080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant