Conversation
src/ArrayDiffMultidimensional.php
Outdated
| } | ||
|
|
||
| if ($value1 != $value2) { | ||
| if ($value1 !== $value2) { |
There was a problem hiding this comment.
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.
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.