Moved here from https://github.com/sebastianbergmann/phpunit/pull/3335#issuecomment-428570649.
Also replaces #3180.
Removing the $maxDepth
parameter from assertEquals()
etc. will break all tests that use assertEquals()
with optional parameters that go after $maxDepth
.
The only way to clean up assertEquals()
that {hopefully|possibly} causes less problems would be to clean up more drastically and not only remove $maxDepth
but also all optional parameters that come after it. This, too, is not really appealling.
All these optional parameters should have never been added, they make for a terrible API. I am not sure, though, if the benefit of cleaning up assertEquals()
etc. by removing these optional parameters and adding more specific assertion methods in their stead outweighs the pain of breaking compatibility.
The only parameter that I used sometimes is the ignore case one. Never used any other.
Migrating to a dedicated assertion for that seems a reasonable upgrade path for me.
Superseded by #3341.
Most helpful comment
Removing the
$maxDepth
parameter fromassertEquals()
etc. will break all tests that useassertEquals()
with optional parameters that go after$maxDepth
.The only way to clean up
assertEquals()
that {hopefully|possibly} causes less problems would be to clean up more drastically and not only remove$maxDepth
but also all optional parameters that come after it. This, too, is not really appealling.All these optional parameters should have never been added, they make for a terrible API. I am not sure, though, if the benefit of cleaning up
assertEquals()
etc. by removing these optional parameters and adding more specific assertion methods in their stead outweighs the pain of breaking compatibility.