Symfony DependencyInjection: How to represent Closure in YAML service definitions? Symfony DependencyInjection: How to represent Closure in YAML service definitions? symfony symfony

Symfony DependencyInjection: How to represent Closure in YAML service definitions?


You have probably already solved this by now. But you can create a factory that returns a Closure

some_callback:  public: false  class: callback  factory: [SomeClass\Factory, create]

And you can pass that to the addConnector call:

Illuminate\Queue\QueueManager:  arguments:    app: "@app"  calls:    - [ addConnector, ["@Illuminate\\Queue\Connector\NullConnector", "@some_callback"]]