Skip to content

Commit adbc35a

Browse files
committed
Merge array types a bit later
1 parent 746de74 commit adbc35a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Type/TypeCombinator.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,7 @@ public static function union(Type ...$types): Type
210210
$scalarTypes[$classType] = array_values($scalarTypeItems);
211211
}
212212

213-
$types = array_values(
214-
array_merge(
215-
$types,
216-
self::processArrayTypes($arrayTypes),
217-
),
218-
);
213+
$types = array_values($types);
219214
$typesCount = count($types);
220215

221216
foreach ($scalarTypes as $classType => $scalarTypeItems) {
@@ -263,9 +258,14 @@ public static function union(Type ...$types): Type
263258
$newTypes[$type->describe(VerbosityLevel::cache())] = $type;
264259
}
265260
$types = array_values($newTypes);
266-
$typesCount = count($types);
267261
}
268262

263+
$types = array_merge(
264+
$types,
265+
self::processArrayTypes($arrayTypes),
266+
);
267+
$typesCount = count($types);
268+
269269
// transform A | A to A
270270
// transform A | never to A
271271
for ($i = 0; $i < $typesCount; $i++) {

0 commit comments

Comments
 (0)