Skip to content

Commit

Permalink
Merge array types a bit later
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Oct 6, 2023
1 parent 746de74 commit adbc35a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Type/TypeCombinator.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,7 @@ public static function union(Type ...$types): Type
$scalarTypes[$classType] = array_values($scalarTypeItems);
}

$types = array_values(
array_merge(
$types,
self::processArrayTypes($arrayTypes),
),
);
$types = array_values($types);
$typesCount = count($types);

foreach ($scalarTypes as $classType => $scalarTypeItems) {
Expand Down Expand Up @@ -263,9 +258,14 @@ public static function union(Type ...$types): Type
$newTypes[$type->describe(VerbosityLevel::cache())] = $type;
}
$types = array_values($newTypes);
$typesCount = count($types);
}

$types = array_merge(
$types,
self::processArrayTypes($arrayTypes),
);
$typesCount = count($types);

// transform A | A to A
// transform A | never to A
for ($i = 0; $i < $typesCount; $i++) {
Expand Down

0 comments on commit adbc35a

Please sign in to comment.