From 1eb68cb277ef00c6551a4a6c246e4403186eb789 Mon Sep 17 00:00:00 2001 From: Amelie Le Coz Date: Mon, 23 Oct 2023 15:04:37 +0200 Subject: [PATCH] Update service_container.rst Changes in response to my comment on this PR https://github.com/symfony/symfony-docs/pull/18790 --- service_container.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/service_container.rst b/service_container.rst index f1da9c3d203..42acabf48cf 100644 --- a/service_container.rst +++ b/service_container.rst @@ -1420,7 +1420,7 @@ You also have a service that defines many methods and one of them is the same { // other methods... - public function format($string $message, array $parameters): string + public function format(string $message, array $parameters): string { // ... } @@ -1438,7 +1438,7 @@ Thanks to the ``#[AutowireCallable]`` attribute, you can now inject this class Mailer { public function __construct( - #[AutowireCallable(service: MessageUtils::class, method: 'formatMessage')] + #[AutowireCallable(service: MessageUtils::class, method: 'format')] private MessageFormatterInterface $formatter ) { } @@ -1470,7 +1470,7 @@ an adapter for a functional interface through configuration: app.message_formatter: class: App\Service\MessageFormatterInterface - from_callable: [!service {class: 'App\Service\MessageUtils'}, 'formatMessage'] + from_callable: [!service {class: 'App\Service\MessageUtils'}, 'format'] .. code-block:: xml @@ -1485,7 +1485,7 @@ an adapter for a functional interface through configuration: - + @@ -1506,7 +1506,7 @@ an adapter for a functional interface through configuration: $container ->set('app.message_formatter', MessageFormatterInterface::class) - ->fromCallable([inline_service(MessageUtils::class), 'formatMessage']) + ->fromCallable([inline_service(MessageUtils::class), 'format']) ->alias(MessageFormatterInterface::class, 'app.message_formatter') ; };