Skip to content

Commit 166b470

Browse files
committed
minor #18048 DependencyInjection] Deprecate #[MapDecorated] in favor of #[AutowireDecorated] (mdoutreluingne)
This PR was squashed before being merged into the 6.3 branch. Discussion ---------- DependencyInjection] Deprecate `#[MapDecorated]` in favor of `#[AutowireDecorated]` Fixes #18041 Commits ------- bcf4bec DependencyInjection] Deprecate `#[MapDecorated]` in favor of `#[AutowireDecorated]`
2 parents 7838a50 + bcf4bec commit 166b470

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

reference/attributes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ Dependency Injection
3434
* :ref:`Autoconfigure <lazy-services_configuration>`
3535
* :ref:`AutoconfigureTag <di-instanceof>`
3636
* :ref:`Autowire <autowire-attribute>`
37+
* :doc:`AutowireDecorated </service_container/service_decoration>`
3738
* :ref:`Exclude <service-psr4-loader>`
38-
* :doc:`MapDecorated </service_container/service_decoration>`
3939
* :ref:`TaggedIterator <tags_reference-tagged-services>`
4040
* :ref:`TaggedLocator <service-subscribers-locators_defining-service-locator>`
4141
* :ref:`Target <autowiring-multiple-implementations-same-type>`

service_container/service_decoration.rst

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ automatically changed to ``'.inner'``):
150150
151151
// ...
152152
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
153-
use Symfony\Component\DependencyInjection\Attribute\MapDecorated;
153+
use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated;
154154
155155
#[AsDecorator(decorates: Mailer::class)]
156156
class DecoratingMailer
157157
{
158158
private $inner;
159159
160-
public function __construct(#[MapDecorated] $inner)
160+
public function __construct(#[AutowireDecorated] $inner)
161161
{
162162
$this->inner = $inner;
163163
}
@@ -215,6 +215,12 @@ automatically changed to ``'.inner'``):
215215
->args([service('.inner')]);
216216
};
217217
218+
.. deprecated:: 6.3
219+
220+
The ``#[MapDecorated]`` attribute is deprecated since Symfony 6.3.
221+
Instead, use the
222+
:class:`#[AutowireDecorated] <Symfony\\Component\\DependencyInjection\\Attribute\\AutowireDecorated>` attribute.
223+
218224
.. tip::
219225

220226
The visibility of the decorated ``App\Mailer`` service (which is an alias
@@ -293,14 +299,14 @@ the ``decoration_priority`` option. Its value is an integer that defaults to
293299
294300
// ...
295301
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
296-
use Symfony\Component\DependencyInjection\Attribute\MapDecorated;
302+
use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated;
297303
298304
#[AsDecorator(decorates: Foo::class, priority: 5)]
299305
class Bar
300306
{
301307
private $inner;
302308
303-
public function __construct(#[MapDecorated] $inner)
309+
public function __construct(#[AutowireDecorated] $inner)
304310
{
305311
$this->inner = $inner;
306312
}
@@ -312,7 +318,7 @@ the ``decoration_priority`` option. Its value is an integer that defaults to
312318
{
313319
private $inner;
314320
315-
public function __construct(#[MapDecorated] $inner)
321+
public function __construct(#[AutowireDecorated] $inner)
316322
{
317323
$this->inner = $inner;
318324
}
@@ -616,15 +622,15 @@ Three different behaviors are available:
616622
617623
// ...
618624
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
619-
use Symfony\Component\DependencyInjection\Attribute\MapDecorated;
625+
use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated;
620626
use Symfony\Component\DependencyInjection\ContainerInterface;
621627
622628
#[AsDecorator(decorates: Mailer::class, onInvalid: ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]
623629
class Bar
624630
{
625631
private $inner;
626632
627-
public function __construct(#[MapDecorated] $inner)
633+
public function __construct(#[AutowireDecorated] $inner)
628634
{
629635
$this->inner = $inner;
630636
}

service_container/service_subscribers_locators.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ method directly:
262262
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator`
263263
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator`
264264
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Target`
265-
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\MapDecorated`
265+
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireDecorated`
266266

267267
This is done by having ``getSubscribedServices()`` return an array of
268268
:class:`Symfony\\Contracts\\Service\\Attribute\\SubscribedService` objects
@@ -865,7 +865,7 @@ of the following dependency injection attributes:
865865
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator`
866866
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator`
867867
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Target`
868-
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\MapDecorated`
868+
* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireDecorated`
869869

870870
Here's an example::
871871

0 commit comments

Comments
 (0)