Skip to content

Commit 387ec95

Browse files
committed
minor #19076 [DependencyInjection] Update service_container.rst (amelielecoz)
This PR was merged into the 6.3 branch. Discussion ---------- [DependencyInjection] Update service_container.rst Changes in response to my comment on this PR #18790 Commits ------- 1eb68cb Update service_container.rst
2 parents bf14d85 + 1eb68cb commit 387ec95

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

service_container.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ You also have a service that defines many methods and one of them is the same
14201420
{
14211421
// other methods...
14221422

1423-
public function format($string $message, array $parameters): string
1423+
public function format(string $message, array $parameters): string
14241424
{
14251425
// ...
14261426
}
@@ -1438,7 +1438,7 @@ Thanks to the ``#[AutowireCallable]`` attribute, you can now inject this
14381438
class Mailer
14391439
{
14401440
public function __construct(
1441-
#[AutowireCallable(service: MessageUtils::class, method: 'formatMessage')]
1441+
#[AutowireCallable(service: MessageUtils::class, method: 'format')]
14421442
private MessageFormatterInterface $formatter
14431443
) {
14441444
}
@@ -1470,7 +1470,7 @@ an adapter for a functional interface through configuration:
14701470
14711471
app.message_formatter:
14721472
class: App\Service\MessageFormatterInterface
1473-
from_callable: [!service {class: 'App\Service\MessageUtils'}, 'formatMessage']
1473+
from_callable: [!service {class: 'App\Service\MessageUtils'}, 'format']
14741474
14751475
.. code-block:: xml
14761476
@@ -1485,7 +1485,7 @@ an adapter for a functional interface through configuration:
14851485
<!-- ... -->
14861486
14871487
<service id="app.message_formatter" class="App\Service\MessageFormatterInterface">
1488-
<from-callable method="formatMessage">
1488+
<from-callable method="format">
14891489
<service class="App\Service\MessageUtils"/>
14901490
</from-callable>
14911491
</service>
@@ -1506,7 +1506,7 @@ an adapter for a functional interface through configuration:
15061506
15071507
$container
15081508
->set('app.message_formatter', MessageFormatterInterface::class)
1509-
->fromCallable([inline_service(MessageUtils::class), 'formatMessage'])
1509+
->fromCallable([inline_service(MessageUtils::class), 'format'])
15101510
->alias(MessageFormatterInterface::class, 'app.message_formatter')
15111511
;
15121512
};

0 commit comments

Comments
 (0)