diff --git a/src/Type/UnionTypeHelper.php b/src/Type/UnionTypeHelper.php index 7f8936899e8..e0fed341f1c 100644 --- a/src/Type/UnionTypeHelper.php +++ b/src/Type/UnionTypeHelper.php @@ -70,6 +70,10 @@ public static function getConstantStrings(array $types): array $strings[] = $type->getConstantStrings(); } + if ($strings === []) { + return []; + } + return array_merge(...$strings); }