diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index d622c335b179d..b344342676589 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -322,6 +322,9 @@ private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, a if ($attribute instanceof AutowireCallable) { $value = $attribute->buildDefinition($value, $type, $parameter); } elseif ($lazy = $attribute->lazy) { + if ($this->container->has($type)) { + $type = $this->container->findDefinition($type)->getClass(); + } $definition = (new Definition($type)) ->setFactory('current') ->setArguments([[$value ??= $getValue()]])