Hello,
In the DI service entry, I can request a collection of services that meet the same interface.
For example:
/**
* @param OrderPaymentGatewayInterface[] $providers
*/
public function __construct(array $providers) { ... }
If I am using PhpStan level 9 and want to specify the exact key type in an array, DIC cannot inject services:
/**
* @param array<int, OrderPaymentGatewayInterface> $providers
*/
public function __construct(array $providers) { ... }
The challenge is to add native support for composite array notation with exact key definition. In the first phase, I propose to support only the int key type and mark all others as unsupported.
Why support this notation? Much more strict type within the service.
Thanks.
Hello,
In the DI service entry, I can request a collection of services that meet the same interface.
For example:
If I am using PhpStan level 9 and want to specify the exact key type in an array, DIC cannot inject services:
The challenge is to add native support for composite array notation with exact key definition. In the first phase, I propose to support only the
intkey type and mark all others as unsupported.Why support this notation? Much more strict type within the service.
Thanks.