diff --git a/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php b/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php index abb220b4aa..efd99784e4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php +++ b/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php @@ -112,7 +112,7 @@ trait MicroKernelTrait throw new \LogicException(sprintf('"%s" uses "%s", but does not implement the required method "protected function configureContainer(ContainerConfigurator $c): void".', get_debug_type($this), MicroKernelTrait::class), 0, $e); } - $configuratorClass = $configureContainer->getNumberOfParameters() > 0 && ($type = $configureContainer->getParameters()[0]->getType()) && !$type->isBuiltin() ? $type->getName() : null; + $configuratorClass = $configureContainer->getNumberOfParameters() > 0 && ($type = $configureContainer->getParameters()[0]->getType()) instanceof \ReflectionNamedType && !$type->isBuiltin() ? $type->getName() : null; if ($configuratorClass && !is_a(ContainerConfigurator::class, $configuratorClass, true)) { $this->configureContainer($container, $loader); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredPropertiesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredPropertiesPass.php index 945b8c9e01..24f9c41d2b 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredPropertiesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredPropertiesPass.php @@ -42,7 +42,7 @@ class AutowireRequiredPropertiesPass extends AbstractRecursivePass $properties = $value->getProperties(); foreach ($reflectionClass->getProperties() as $reflectionProperty) { - if (!$reflectionProperty->hasType()) { + if (!($type = $reflectionProperty->getType()) instanceof \ReflectionNamedType) { continue; } if (false === $doc = $reflectionProperty->getDocComment()) { @@ -55,7 +55,7 @@ class AutowireRequiredPropertiesPass extends AbstractRecursivePass continue; } - $type = $reflectionProperty->getType()->getName(); + $type = $type->getName(); $value->setProperty($name, new TypedReference($type, $type, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $name)); }