ReflectionClass:isSubclassOf is either always true or always false #12467
Replies: 1 comment
-
|
Shouldn't be hard to fix it in the related extension: https://github.com/phpstan/phpstan-src/blob/2.1.x/src/Type/Php/ReflectionClassIsSubclassOfTypeSpecifyingExtension.php Feel free to open a bug report about this, thanks. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a function to deduce a full class name (including namespace) from a user provided string. It returns null if no such class exists or is not a subclass of the parent class.
Phpstan says:
If I force the variable type:
The error is:
Notice the output says "will evaluate to true" instead of false.
When I type:
The error reverts to:
How can I correctly type this code?
Here are examples of picture classes.
Here is the playground link
Beta Was this translation helpful? Give feedback.
All reactions