Skip to content

Commit

Permalink
TypeCombinator - eliminate same types before normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Oct 2, 2021
1 parent f3c054b commit ac6a102
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Type/TypeCombinator.php
Expand Up @@ -326,6 +326,14 @@ public static function union(Type ...$types): Type
$scalarTypes[$classType] = $scalarTypeItems;
}

if (count($types) > 16) {
$newTypes = [];
foreach ($types as $type) {
$newTypes[$type->describe(VerbosityLevel::cache())] = $type;
}
$types = array_values($newTypes);
}

// transform A | A to A
// transform A | never to A
$typesCount = count($types);
Expand Down

0 comments on commit ac6a102

Please sign in to comment.