Skip to content

Commit 5d6893f

Browse files
committed
minor #16586 [DependencyInjection] Update configurators.rst (PierreJoube)
This PR was merged into the 5.4 branch. Discussion ---------- [DependencyInjection] Update configurators.rst The first configuration example (PHP) at https://symfony.com/doc/current/service_container/configurators.html#using-the-configurator will never work because ConfiguratorTrait::configurator(string|array|ReferenceConfigurator $configurator) expect only one parameter. Configurator will try to call special __invoke() (which is probably undefined at this point) method while the user expects to call configure() method. We must provide an array in this case. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `6.x` for features of unreleased versions). --> Commits ------- c3afa28 Update configurators.rst
2 parents d10e121 + c3afa28 commit 5d6893f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

service_container/configurators.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ all the classes are already loaded as services. All you need to do is specify th
181181
// override the services to set the configurator
182182
// In versions earlier to Symfony 5.1 the service() function was called ref()
183183
$services->set(NewsletterManager::class)
184-
->configurator(service(EmailConfigurator::class), 'configure');
184+
->configurator([service(EmailConfigurator::class), 'configure']);
185185
186186
$services->set(GreetingCardManager::class)
187-
->configurator(service(EmailConfigurator::class), 'configure');
187+
->configurator([service(EmailConfigurator::class), 'configure']);
188188
};
189189
190190
.. _configurators-invokable:

0 commit comments

Comments
 (0)