Fix ImpossibleCheckTypeFunctionCallRule for `is_subclass_of` and `is_a`
Closes https://github.com/phpstan/phpstan/issues/3979 which can be simplified to https://phpstan.org/r/ef72a996-8fbe-4a4e-831f-4d78c542ad19
I'm not sure there is a better (easy ?) fix for this issue. is_subclass_of($string, $bar) specify the type of $string to class-string when true, but it doesn't mean that the call is useless if the param is already a class-string.
I discovered there was an exclusion of is_a in the ImpossibleCheckTypeFunctionCallRule (maybe for the same reason)
so I think it could be the same for is_subclass_of since the behavior is similar.
Changing the rule is not going to help you against "Result of && is always false.".
I'd much rather change the logic in IsSubclassOfFunctionTypeSpecifyingExtension.
This pull request has been marked as ready for review.
I'd much rather change the logic in IsSubclassOfFunctionTypeSpecifyingExtension.
I think it was possible indeed, I get something working.
Friendly ping @ondrejmirtes ; this PR is ready to be re-reviewed :)
Thank you.
Unfortunately I have to revert this. it leads to false positives like: https://phpstan.org/r/5941cd95-26d7-49cf-a2e0-ffc21c4a7697
Unfortunately I have to revert this. it leads to false positives like: phpstan.org/r/5941cd95-26d7-49cf-a2e0-ffc21c4a7697
No problem, I'll try to improve the idea in https://github.com/phpstan/phpstan-src/pull/3788 Did you had another false positive I have to add as non-regression test ?