diff --git a/service_container/service_decoration.rst b/service_container/service_decoration.rst index 7bf1fb9165d..7516a311e86 100644 --- a/service_container/service_decoration.rst +++ b/service_container/service_decoration.rst @@ -146,6 +146,7 @@ automatically changed to ``'.inner'``): namespace App; // ... + use App\Mailer; use Symfony\Component\DependencyInjection\Attribute\AsDecorator; use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated; @@ -153,8 +154,9 @@ automatically changed to ``'.inner'``): class DecoratingMailer { public function __construct( - #[AutowireDecorated] - private object $inner, + // unlike other configuration formats, that name the decorated service argument + // as `$inner` by default, when using attributes you can choose any variable name + #[AutowireDecorated] private Mailer $mailer, ) { }