Skip to content

Commit d18314d

Browse files
committed
Microoptimization
1 parent da9e061 commit d18314d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Type/TypeCombinator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,22 +293,22 @@ public static function union(Type ...$types): Type
293293
continue;
294294
}
295295

296-
for ($i = 0; $i < count($scalarTypeItems); $i++) {
297-
for ($j = 0; $j < count($types); $j++) {
298-
$compareResult = self::compareTypesInUnion($scalarTypeItems[$i], $types[$j]);
296+
for ($i = 0; $i < count($types); $i++) {
297+
for ($j = 0; $j < count($scalarTypeItems); $j++) {
298+
$compareResult = self::compareTypesInUnion($types[$i], $scalarTypeItems[$j]);
299299
if ($compareResult === null) {
300300
continue;
301301
}
302302

303303
[$a, $b] = $compareResult;
304304
if ($a !== null) {
305-
$scalarTypeItems[$i] = $a;
306-
array_splice($types, $j--, 1);
305+
$types[$i] = $a;
306+
array_splice($scalarTypeItems, $j--, 1);
307307
continue 1;
308308
}
309309
if ($b !== null) {
310-
$types[$j] = $b;
311-
array_splice($scalarTypeItems, $i--, 1);
310+
$scalarTypeItems[$j] = $b;
311+
array_splice($types, $i--, 1);
312312
continue 2;
313313
}
314314
}

0 commit comments

Comments
 (0)