Closed IanDelMar closed 1 year ago
This PR fixes the return type of has_filter() and has_action() for maybe false types.
has_filter()
has_action()
A maybe false type such as callable|string|array|false is not an instance of MixedType in https://github.com/szepeviktor/phpstan-wordpress/blob/5c6c6c47b77251ba2c0753c3ff8842cb08190f9e/src/HasFilterDynamicFunctionReturnTypeExtension.php#L42-L47
callable|string|array|false
Failing test:
// Maybe false callback /** @var callable|string|array|false $callback */ $callback = $_GET['callback']; assertType('bool|int', has_filter('', $callback)); assertType('bool|int', has_action('', $callback));
This PR also replaces a deprecated instanceof ConstantBooleanType.
instanceof ConstantBooleanType
This PR fixes the return type of
has_filter()
andhas_action()
for maybe false types.A maybe false type such as
callable|string|array|false
is not an instance of MixedType in https://github.com/szepeviktor/phpstan-wordpress/blob/5c6c6c47b77251ba2c0753c3ff8842cb08190f9e/src/HasFilterDynamicFunctionReturnTypeExtension.php#L42-L47Failing test:
This PR also replaces a deprecated
instanceof ConstantBooleanType
.