diff --git a/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php b/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php index 6c192a6f5f..05a68229a3 100644 --- a/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php +++ b/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php @@ -45,10 +45,10 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface */ private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbstract $function): ?string { - if (!($type = $parameter->getType()) instanceof \ReflectionNamedType) { + if (!$type = $parameter->getType()) { return null; } - $name = $type->getName(); + $name = $type instanceof \ReflectionNamedType ? $type->getName() : (string) $type; if ($function instanceof \ReflectionMethod) { $lcName = strtolower($name);