Skip to content

Commit b00dde1

Browse files
committed
Code Quality: Add @phpstan-assert-if-true to is_wp_error().
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
1 parent 105c7aa commit b00dde1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/wp-includes/load.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,6 +1798,8 @@ function wp_doing_cron() {
17981798
*
17991799
* @param mixed $thing The variable to check.
18001800
* @return bool Whether the variable is an instance of WP_Error.
1801+
*
1802+
* @phpstan-assert-if-true WP_Error $thing
18011803
*/
18021804
function is_wp_error( $thing ) {
18031805
$is_wp_error = ( $thing instanceof WP_Error );

0 commit comments

Comments
 (0)