Are anonymous inline invokable factories possible with Symfony?

181 Views Asked by At

I can define anonymous inline factory (Symfony 6+) like this:

GuzzleClient1:
    class: GuzzleHttp\ClientInterface
    factory: [ !service { class: 'App\GuzzleClientFactory', calls: [ { 'withBaseUri': [ 'http://example.com' ] } ] }, 'build' ]

or like this:

GuzzleClient1:
    class: GuzzleHttp\ClientInterface
    factory:
        - !service
          class: 'App\GuzzleClientFactory'
          calls:
            - withBaseUri: ['http://example.com' ]
        - 'build'

but I can't figure out the correct syntax for anonymous inline invokable factory. How do I omit method name here?

0

There are 0 best solutions below