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
I don't think that PHPStan should do this check in a way that seems too strict. Why? If I remove the default arm now and then, in the future, add a new enum value, I will get a PHP error but not my clean exception. Of course PHPStan will warn me: Match expression does not handle remaining value.
When you add a new enum value, PHPStan tells you if you need to handle it here. That's preferred because you instantly know all the places where you need to handle the new value.
With the default branch, if you add a new enum case, you'll start getting runtime exceptions in your production logs. And SA will not tell you about the places where you need to handle the new value. That's suboptimal.
Match arm comparison between AttendanceCountMetric::TODAY_UNIQUE_OUTS and AttendanceCountMetric::TODAY_UNIQUE_OUTS is always true.
Remove remaining cases below this one and this error will disappear too.
Bug report
I can understand why this is happening: I'm covering all
AttendanceCountMetric
inmatch
. As soon as I add a new enum value, the error disappear.Is this an intended behaviour or a bug?
Match arm is unreachable because previous comparison is always true:
I don't think that PHPStan should do this check in a way that seems too strict. Why? If I remove the
default
arm now and then, in the future, add a new enum value, I will get a PHP error but not my clean exception. Of course PHPStan will warn me: Match expression does not handle remaining value.Code snippet that reproduces the problem
https://phpstan.org/r/111fc61d-ba17-4b76-a536-66b0cd398c1a
Expected output
No errors regarding
match
.Did PHPStan help you today? Did it make you happy in any way?
No response
The text was updated successfully, but these errors were encountered: