-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Add service_closure() to the PHP-DSL #42625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DependencyInjection] Add service_closure() to the PHP-DSL #42625
Conversation
->args([service_closure(service('foo'))]); | ||
|
||
$s->set('service_closure_invalid', 'Bar') | ||
->args([service_closure(service('invalid_service')->nullOnInvalid())]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'd be great to be able to do this instead:
service_closure('invalid_service')->nullOnInvalid()
maybe with a new ClosureReferenceConfigurator
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolas-grekas Done. The fabbot failure is unrelated to my changes, I can apply it if you want.
@HypeMC Can you submit a PR on the docs? Or at least, give a full usage example in the PR description to help the doc team? Thank you. |
@fabpot Sure, I'll submit a PR sometime tomorrow. |
@fabpot PR(s) on the docs added: symfony/symfony-docs#15730 and symfony/symfony-docs#15731 |
Thank you @HypeMC. |
…es (HypeMC) This PR was merged into the 5.4 branch. Discussion ---------- [DependencyInjection] Add section about Service Closures Documents service closures added in symfony/symfony#21770 and symfony/symfony#41176, and the `service_closure()` PHP-DSL function added in symfony/symfony#42625 . Commits ------- f2b2fdb [DI] Add section about Service Closures
Adds a
service_closure()
function to the PHP-DSL.