8000 Minor reword · symfony/symfony-docs@dd658c6 · GitHub
[go: up one dir, main page]

Skip to content

Commit dd658c6

Browse files
committed
Minor reword
1 parent 59d5b18 commit dd658c6

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

service_container/autowiring.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -553,16 +553,16 @@ If the argument is named ``$shoutyTransformer``,
553553
But, you can also manually wire any *other* service by specifying the argument
554554
under the arguments key.
555555

556-
Another possibility is to use the ``#[Target]`` attribute. By using this attribute
557-
on the argument you want to autowire, you can define exactly which service to inject
558-
by passing the name of the argument used in the named alias. Thanks to this, you're able
559-
to have multiple services implementing the same interface and keep the argument name
560-
decorrelated of any implementation name (like shown in the example above).
556+
Another option is to use the ``#[Target]`` attribute. By adding this attribute
557+
to the argument you want to autowire, you can specify which service to inject by
558+
passing the name of the argument used in the named alias. This way, you can have
559+
multiple services implementing the same interface and keep the argument name
560+
separate from any implementation name (like shown in the example above).
561561

562562
.. warning::
563563

564-
The ``#[Target]`` attribute only accepts the name of the argument used in the named
565-
alias, it ** 8000 does not** accept service ids or service aliases.
564+
The ``#[Target]`` attribute only accepts the name of the argument used in the
565+
named alias; it **does not** accept service ids or service aliases.
566566

567567
Suppose you want to inject the ``App\Util\UppercaseTransformer`` service. You would use
568568
the ``#[Target]`` attribute by passing the name of the ``$shoutyTransformer`` argument::
@@ -584,8 +584,10 @@ the ``#[Target]`` attribute by passing the name of the ``$shoutyTransformer`` ar
584584
}
585585
}
586586

587-
Since the ``#[Target]`` attribute normalizes the string passed to it to its camelCased form,
588-
name variations such as ``shouty.transformer`` also work.
587+
.. tip::
588+
589+
Since the ``#[Target]`` attribute normalizes the string passed to it to its
590+
camelCased form, name variations (e.g. ``shouty.transformer``) also work.
589591

590592
.. note::
591593

0 commit comments

Comments
 (0)
0