You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a variable is assigned in each arm of a match statement, it will still be reported as "Variable $foo might not be defined". The code can be rewritten to be easier to read, but this still looks like a bug.
Variable $foo should always be considered defined when it is assigned in each match arm.
Did PHPStan help you today? Did it make you happy in any way?
I love PHPStan, level 9 and strict rules all the way!
The text was updated successfully, but these errors were encountered:
PrinsFrank
changed the title
"Variable might not be defined" when Always assigning variable in match arm
"Variable might not be defined" when always assigning variable in match arm
Apr 19, 2024
Bug report
When a variable is assigned in each arm of a match statement, it will still be reported as "Variable $foo might not be defined". The code can be rewritten to be easier to read, but this still looks like a bug.
Code snippet that reproduces the problem
https://phpstan.org/r/b99db06d-4934-4b9d-8862-778f00bee23b
Expected output
Variable $foo should always be considered defined when it is assigned in each match arm.
Did PHPStan help you today? Did it make you happy in any way?
I love PHPStan, level 9 and strict rules all the way!
The text was updated successfully, but these errors were encountered: