diff --git a/composer.json b/composer.json index c71c1e58..ddaa9b54 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "nikic/php-parser": "< 4.12.0", "php-stubs/generator": "^0.8.3", "phpdocumentor/reflection-docblock": "^5.3", - "phpstan/phpstan": "^1.2" + "phpstan/phpstan": "^1.9" }, "suggest": { "paragonie/sodium_compat": "Pure PHP implementation of libsodium", diff --git a/functionMap.php b/functionMap.php index 1a505e16..c44b4c2a 100644 --- a/functionMap.php +++ b/functionMap.php @@ -65,4 +65,5 @@ 'WP_Block_List::offsetGet' => ['WP_Block|null', 'offset'=>'int'], 'WP_Block_List::offsetSet' => ['void', 'offset'=>'int|null'], 'WP_Block_List::offsetUnset' => ['void', 'offset'=>'int'], + 'is_wp_error' => ['bool', '@phpstan-assert-if-true'=>'\WP_Error $thing'] ]; diff --git a/wordpress-stubs.php b/wordpress-stubs.php index 9157cb6a..956ed348 100644 --- a/wordpress-stubs.php +++ b/wordpress-stubs.php @@ -110284,6 +110284,8 @@ function wp_doing_cron() * * @param mixed $thing The variable to check. * @return bool Whether the variable is an instance of WP_Error. + * @phpstan-assert-if-true \WP_Error $thing + * @phpstan-return bool */ function is_wp_error($thing) {