Commit d6392af
committed
minor #17199 Fix dependency injection PHP sample code (jdecool)
This PR was merged into the 5.4 branch.
Discussion
----------
Fix dependency injection PHP sample code
I've just noticed that there is an error in the code sample:
```php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return static function (ContainerConfigurator $container) {
$container->parameters()
// ...
->set('mailer.transport', 'sendmail')
;
$container->services()
->set('mailer', 'Mailer')
->args(['%mailer.transport%'])
$services->set('mailer', 'Mailer')
// the param() method was introduced in Symfony 5.2.
->args([param('mailer.transport')])
;
$services->set('newsletter_manager', 'NewsletterManager')
// In versions earlier to Symfony 5.1 the service() function was called ref()
->call('setMailer', [service('mailer')])
;
};
```
The `$services` is not defined.
Commits
-------
087773a Fix dependency injection PHP sample code1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | | - | |
301 | | - | |
302 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| |||
0 commit comments