-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
phpstan/phpstan-src
#3900Labels
Milestone
Description
Bug report
After some trial and error, it seems that the first branch (the one we are falling though) does not narrow the value type for follow up branches.
For example, if you swap lines 12-13 in the provided example, the warning changes to get_class expects object, IClass|string given (instead of IClass|null). Unless I'm missing something, this would be a bug, since other branches seem to work fine.
Note: for my current use-case, and in general, splitting the branches (without fall-throughs) is a good workaround.
Code snippet that reproduces the problem
https://phpstan.org/r/46475e6a-20c2-476c-860d-ff70a934b449
Expected output
There shouldn't be any warnings, since both types/branches are actually handled.
Did PHPStan help you today? Did it make you happy in any way?
No response
Reactions are currently unavailable