Skip to content

Commit

Permalink
Truncate description of huge UnionType
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 22, 2024
1 parent b4dbfa4 commit 039a3dc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Type/UnionType.php
Expand Up @@ -29,6 +29,7 @@
use PHPStan\Type\Traits\NonGeneralizableTypeTrait;
use function array_map;
use function array_merge;
use function array_slice;
use function array_unique;
use function array_values;
use function count;
Expand Down Expand Up @@ -292,6 +293,10 @@ public function describe(VerbosityLevel $level): string
}
}

if (count($typeNames) > 1024) {
return implode('|', array_slice($typeNames, 0, 1024)) . "|\u{2026}";
}

return implode('|', $typeNames);
};

Expand Down

0 comments on commit 039a3dc

Please sign in to comment.