diff --git a/src/Framework/Constraint/ArraySubset.php b/src/Framework/Constraint/ArraySubset.php index 5ffc1e11c7e..36be091d726 100644 --- a/src/Framework/Constraint/ArraySubset.php +++ b/src/Framework/Constraint/ArraySubset.php @@ -63,7 +63,6 @@ public function evaluate($other, $description = '', $returnResult = false) $this->subset = $this->toArray($this->subset); $intersect = $this->arrayIntersectRecursive($other, $this->subset); - $this->deepSort($intersect); $this->deepSort($this->subset); @@ -130,13 +129,9 @@ private function toArray(iterable $other): array private function isAssociative(array $array): bool { - return \array_reduce( - \array_keys($array), - function (bool $carry, $key): bool { - return $carry || \is_string($key); - }, - false - ); + return \array_reduce(\array_keys($array), function (bool $carry, $key): bool { + return $carry || \is_string($key); + }, false); } private function compare($first, $second): bool @@ -152,8 +147,6 @@ private function deepSort(array &$array): void } } - unset($value); - if ($this->isAssociative($array)) { \ksort($array); } else { @@ -197,7 +190,10 @@ private function arrayIntersectRecursive(array $array, array $subset): array } } else { foreach ($subset as $key => $subset_value) { - if (!\is_array($subset_value) && $this->compare($subset_value, $array_value)) { + if (!\is_array($subset_value) && $this->compare( + $subset_value, + $array_value + )) { $intersect[$key] = $array_value; break;