Skip to content

Commit f3b1df0

Browse files
Fix CS/WS issues
1 parent 84d01bb commit f3b1df0

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/Framework/Constraint/ArraySubset.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public function evaluate($other, $description = '', $returnResult = false)
6565
$this->subset = $this->toArray($this->subset);
6666

6767
$intersect = $this->arrayIntersectRecursive($other, $this->subset);
68+
6869
$this->deepSort($intersect);
6970
$this->deepSort($this->subset);
7071

@@ -131,9 +132,13 @@ private function toArray(iterable $other): array
131132

132133
private function isAssociative(array $array): bool
133134
{
134-
return \array_reduce(\array_keys($array), function (bool $carry, $key): bool {
135-
return $carry || \is_string($key);
136-
}, false);
135+
return \array_reduce(
136+
\array_keys($array),
137+
function (bool $carry, $key): bool {
138+
return $carry || \is_string($key);
139+
},
140+
false
141+
);
137142
}
138143

139144
private function compare($first, $second): bool
@@ -149,6 +154,8 @@ private function deepSort(array &$array): void
149154
}
150155
}
151156

157+
unset($value);
158+
152159
if ($this->isAssociative($array)) {
153160
\ksort($array);
154161
} else {
@@ -192,10 +199,7 @@ private function arrayIntersectRecursive(array $array, array $subset): array
192199
}
193200
} else {
194201
foreach ($subset as $key => $subset_value) {
195-
if (!\is_array($subset_value) && $this->compare(
196-
$subset_value,
197-
$array_value
198-
)) {
202+
if (!\is_array($subset_value) && $this->compare($subset_value, $array_value)) {
199203
$intersect[$key] = $array_value;
200204

201205
break;

0 commit comments

Comments
 (0)