-
Notifications
You must be signed in to change notification settings - Fork 356
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
Make the enum element comparison strict #132
Conversation
The current check is matching numeric strings that are not equal ( like "604.1" == "604.10" because of PHP's == behavior that converts numeric strings to numbers and then performs a numeric comparison), even if type is checked before the comparison, the value should be identic
[Proposal] new constraints name - for PHP7
@loucho have you reviewed the failing unit test in the build for this PR? |
Oh, hadn't thought of that, i just checked it, seems my change fails when comparing an object (I assume that this is because objects are not === unless they are a reference to the same object in memory or something). Maybe add a check for objects before making the comparison? what do you think? |
@loucho sorry for the late response. Would you please rebase for a clean build? |
The current check is matching numeric strings that are not equal ( like "604.1" == "604.10" because of PHP's == behavior that converts numeric strings to numbers and then performs a numeric comparison), even if type is checked before the comparison, the value should be identic
…=== for everything else)
Rebased and made the change, waiting on the CI tests |
@loucho solid improvement. I am inclined to suggest wrapping the returns in curlies for consistency sake, and a good rebase would distill this PR down to a single new commit, but it's all good. +1 I will merge this with another 👍 from the community. Would you mind helping review some other PRs for their community 👍? I am sure they will return the favor 😄 #105 needs review. |
This is a bug fix so +1 ! |
Thanks for the review @onlinesid! Let's call this 1.4.1. |
Make the enum element comparison strict
Sure, will do |
The current check is matching numeric strings that are not equal ( like "604.1" == "604.10" because of PHP's == behavior that converts numeric strings to numbers and then performs a numeric comparison), even if type is checked before the comparison, the value should be identic