From 55640594ffc0fc624f29c2d8c86286ac39a2b752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 11 Jun 2025 17:24:29 +0200 Subject: [PATCH] [DependencyInjection] Respect original service class when a proxy is defined --- .../Component/DependencyInjection/Compiler/AutowirePass.php | 3 +++ 1 file changed, 3 insertions(+) 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()]])