di icon indicating copy to clipboard operation
di copied to clipboard

Allow combination of splat operator and multiple services

Open survik1 opened this issue 5 years ago • 1 comments

In case of dynamic service creation it would be nice to have possibility to inject all services trough splat operator.

interface IService{} class ServiceA implements IService {} class ServiceB implements IService {}

Autowiring both services and requiring DI to load IService will trigger Multiple services exception. The following code should, however, be allowed

__construct(IService ...$services) {}

survik1 avatar May 21 '20 08:05 survik1

I think that this is improper usage of splat operator, so I dont want to support it.

dg avatar May 21 '20 12:05 dg

Duplicate #244

dg avatar Jan 17 '23 00:01 dg