diff --git a/ChangeLog.md b/ChangeLog.md index 1bcc3b2a..e0daece1 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -26,6 +26,12 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt * Removed support for PHP 8.1 +## [5.0.3] - 2024-10-18 + +### Fixed + +* Reverted [#113](https://github.com/sebastianbergmann/comparator/pull/113) as it broke backward compatibility + ## [5.0.2] - 2024-08-12 ### Fixed @@ -178,6 +184,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt [6.0.2]: https://github.com/sebastianbergmann/comparator/compare/6.0.1...6.0.2 [6.0.1]: https://github.com/sebastianbergmann/comparator/compare/6.0.0...6.0.1 [6.0.0]: https://github.com/sebastianbergmann/comparator/compare/5.0...6.0.0 +[5.0.3]: https://github.com/sebastianbergmann/comparator/compare/5.0.2...5.0.3 [5.0.2]: https://github.com/sebastianbergmann/comparator/compare/5.0.1...5.0.2 [5.0.1]: https://github.com/sebastianbergmann/comparator/compare/5.0.0...5.0.1 [5.0.0]: https://github.com/sebastianbergmann/comparator/compare/4.0.8...5.0.0 diff --git a/src/ArrayComparator.php b/src/ArrayComparator.php index d6f68bba..5af5a437 100644 --- a/src/ArrayComparator.php +++ b/src/ArrayComparator.php @@ -9,7 +9,6 @@ */ namespace SebastianBergmann\Comparator; -use function array_is_list; use function array_key_exists; use function assert; use function is_array; @@ -42,13 +41,8 @@ public function assertEquals(mixed $expected, mixed $actual, float $delta = 0.0, assert(is_array($actual)); if ($canonicalize) { - if (array_is_list($expected)) { - sort($expected); - } - - if (array_is_list($actual)) { - sort($actual); - } + sort($expected); + sort($actual); } $remaining = $actual; diff --git a/tests/unit/ArrayComparatorTest.php b/tests/unit/ArrayComparatorTest.php index d16fedfa..96ceadd9 100644 --- a/tests/unit/ArrayComparatorTest.php +++ b/tests/unit/ArrayComparatorTest.php @@ -73,30 +73,6 @@ public static function assertEqualsSucceedsProvider(): array ['true'], [true], ], - [ - [1, [1, 2, 3]], - [[3, 1, 2], 1], - 0, - true, - ], - [ - [1, [4, 7], [1, 2, 3], [0, 0, 0, 0]], - [[3, 1, 2], [0, 0, 0, 0], [4, 7], 1], - 0, - true, - ], - [ - [1, [4, [4, 5, 6, 7, 8]], [1, 2, 3]], - [[3, 1, 2], [[4, 8, 6, 7, 5], 4], 1], - 0, - true, - ], - [ - [null, null, 1, 1], - [1, null, 1, null], - 0, - true, - ], ]; } @@ -145,24 +121,6 @@ public static function assertEqualsFailsProvider(): array ['false'], [false], ], - [ - ['a' => '1', 'b' => '2'], - ['c' => '1', 'd' => '2'], - 0, - true, - ], - [ - ['a' => '1', 'b' => '2'], - ['a' => '2', 'b' => '1'], - 0, - true, - ], - [ - ['a' => '1', 'b' => '2'], - ['a' => '1', 'b' => '2', 'c' => '2'], - 0, - true, - ], ]; }