-
Notifications
You must be signed in to change notification settings - Fork 16
Version 2 #10
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
src/ArrayDiffMultidimensional.php
Outdated
| } | ||
|
|
||
| if ($value1 != $value2) { | ||
| if ($value1 !== $value2) { |
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.
Is it necessary to compare types too?
What is an expected result for comparing these two arrays: ['a' => 1] and ['a' => '1']
What if the compare method has the 3rd parameter $strict = true?
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.
Hi,
The example you exposed could be a bug detection in a codebase where an integer is converted by error to a string, or vice-versa.
IMO strict comparisons should be the only comparison type to use since 1 is totally different to '1'
Anyway, if using a loose comparison method is a required feature, I will not remove it.
I agree with adding a 3rd parameter, but since version 2 is a great opportunity for breaking changes, it will be true by default.
I will also add specific methods like strictCompare() and looselyCompare() since they look clearer for me.
Thank you very much for your suggestion.
|
Kudos, SonarCloud Quality Gate passed!
|
Uh oh!
There was an error while loading. Please reload this page.