Skip to content

Commit 5a44c29

Browse files
committed
Optimization - do not sort huge unions
1 parent 89ceb6a commit 5a44c29

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Type/UnionTypeHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ public static function getReferencedClasses(array $types): array
3232
*/
3333
public static function sortTypes(array $types): array
3434
{
35+
if (count($types) > 1024) {
36+
return $types;
37+
}
38+
3539
usort($types, static function (Type $a, Type $b): int {
3640
if ($a instanceof NullType) {
3741
return 1;

0 commit comments

Comments
 (0)