Skip to content

Commit 7454465

Browse files
committed
[DependencyInjection] Update the docs about decoration
1 parent f44e21d commit 7454465

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

service_container/service_decoration.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,17 @@ automatically changed to ``'.inner'``):
146146
namespace App;
147147
148148
// ...
149+
use App\Mailer;
149150
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
150151
use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated;
151152
152153
#[AsDecorator(decorates: Mailer::class)]
153154
class DecoratingMailer
154155
{
155156
public function __construct(
156-
#[AutowireDecorated]
157-
private object $inner,
157+
// unlike other configuration formats, that name the decorated service argument
158+
// as `$inner` by default, when using attributes you can choose any variable name
159+
#[AutowireDecorated] private Mailer $mailer,
158160
) {
159161
}
160162

0 commit comments

Comments
 (0)