Fix ImpossibleCheckTypeFunctionCallRule for is_subclass_of and is_a#3404
Fix ImpossibleCheckTypeFunctionCallRule for is_subclass_of and is_a#3404ondrejmirtes merged 7 commits intophpstan:1.12.xfrom
is_subclass_of and is_a#3404Conversation
|
Changing the rule is not going to help you against "Result of && is always false.". I'd much rather change the logic in IsSubclassOfFunctionTypeSpecifyingExtension. |
591e804 to
10eb37a
Compare
is_subclass_ofis_subclass_of and is_a
8704421 to
8443ae3
Compare
There was a problem hiding this comment.
if (is_subclass_of($object, $stringOrNull, false))
specified $object as object but this was already known so it's not a big loss.
8443ae3 to
8d67889
Compare
|
This pull request has been marked as ready for review. |
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 |
No problem, I'll try to improve the idea in #3788 |
Closes phpstan/phpstan#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$stringto 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_ain theImpossibleCheckTypeFunctionCallRule(maybe for the same reason)so I think it could be the same for
is_subclass_ofsince the behavior is similar.