Skip to content

Commit ebf6d8d

Browse files
Add @phpstan-assert to is_wp_error (#69)
* Add `@phpstan-assert` to `is_wp_error` * Raise PHPStan version --------- Co-authored-by: Viktor Szépe <viktor@szepe.net>
1 parent 258c316 commit ebf6d8d

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"nikic/php-parser": "< 4.12.0",
1414
"php-stubs/generator": "^0.8.3",
1515
"phpdocumentor/reflection-docblock": "^5.3",
16-
"phpstan/phpstan": "^1.2"
16+
"phpstan/phpstan": "^1.9"
1717
},
1818
"suggest": {
1919
"paragonie/sodium_compat": "Pure PHP implementation of libsodium",

functionMap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@
6565
'WP_Block_List::offsetGet' => ['WP_Block|null', 'offset'=>'int'],
6666
'WP_Block_List::offsetSet' => ['void', 'offset'=>'int|null'],
6767
'WP_Block_List::offsetUnset' => ['void', 'offset'=>'int'],
68+
'is_wp_error' => ['bool', '@phpstan-assert-if-true'=>'\WP_Error $thing']
6869
];

wordpress-stubs.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110284,6 +110284,8 @@ function wp_doing_cron()
110284110284
*
110285110285
* @param mixed $thing The variable to check.
110286110286
* @return bool Whether the variable is an instance of WP_Error.
110287+
* @phpstan-assert-if-true \WP_Error $thing
110288+
* @phpstan-return bool
110287110289
*/
110288110290
function is_wp_error($thing)
110289110291
{

0 commit comments

Comments
 (0)