-
Notifications
You must be signed in to change notification settings - Fork 548
Implement identical/equal comparisons on EnumCaseObjectType #2095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
181d10c to
808a80b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this new error is a bit misleading. not sure we want to keep it like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in contrast, I like this error way more then the one we had before this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use EnumCaseObjectType::equals() instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch - fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
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