Implement identical/equal comparisons on EnumCaseObjectType#2095
Conversation
181d10c to
808a80b
Compare
There was a problem hiding this comment.
this new error is a bit misleading. not sure we want to keep it like that.
There was a problem hiding this comment.
in contrast, I like this error way more then the one we had before this PR
There was a problem hiding this comment.
Use EnumCaseObjectType::equals() instead.
There was a problem hiding this comment.
good catch - fixed
527aa5c to
05d94fa
Compare
|
This pull request has been marked as ready for review. |
|
Thank you! |
|
Sorry, I had to revert this, it's pretty annoying in practice. We first need to do a different feature in order for this one to be less annoying. |
|
no problem. in case there is something I can do, please open a issue about the thing we need, so I can investigate. |
|
The problem is that this now reports "always true" for the last Also arguably last match arm shouldn't report this. Because people might prefer to write So, I have an idea: We need a new custom node visitor to mark the condition expression in last match arm and last elseif with an attribute. And ConstantConditionRuleHelper can use this node attribute to decide that "always true" shouldn't be reported there. There's already an issue for this: phpstan/phpstan#8042 And after this is implemented, we can afford to report all "always true" conditions for everyone in bleedingEdge/2.0, not just phpstan-strict-rules users. Because the most annoying ones will not be reported anymore. |
closes phpstan/phpstan#8485
for comparison see the handling of regular constants/class-constants: https://phpstan.org/r/a6a9d005-a9d5-4f7d-86ad-00a3a3422cec