Replace `TypeSpecifyingExtension` with `@phpstan-assert` for type narrowing
swissspidy opened this issue ยท 4 comments
Now that this package requires PHPStan 1.10.0+, It seems like IsWpErrorFunctionTypeSpecifyingExtension
, AssertWpErrorTypeSpecifyingExtension
, and AssertNotWpErrorTypeSpecifyingExtension
extensions could be replaced with @phpstan-assert
annotations, which were introduced in PHPStan 1.9.0.
These annotations would need to be added in php-stubs/wordpress-tests-stubs
/ php-stubs/wordpress-stubs
of course.
Latest release depends on PHPStan v1.8.7
https://github.com/szepeviktor/phpstan-wordpress/blob/v1.1.7/composer.json#L16
Increase it? ๐
PR for is_wp_error
: php-stubs/wordpress-stubs#69
That annotation probably doesn't work for assertWPError
because it neither throws nor returns a bool, so we still need that extension.
But at least it means we could get rid of IsWpErrorFunctionTypeSpecifyingExtension
at some point
Done ๐