diff --git a/src/Type/UnionTypeHelper.php b/src/Type/UnionTypeHelper.php index c0c99bbd18..0e33878645 100644 --- a/src/Type/UnionTypeHelper.php +++ b/src/Type/UnionTypeHelper.php @@ -32,6 +32,10 @@ public static function getReferencedClasses(array $types): array */ public static function sortTypes(array $types): array { + if (count($types) > 1024) { + return $types; + } + usort($types, static function (Type $a, Type $b): int { if ($a instanceof NullType) { return 1;