Slamdunk / phpstan-laminas-framework

Laminas Framework 3 extensions for PHPStan
MIT License
16 stars 10 forks source link

Actually support alternative containers interfaces for get() return types #38

Closed InvisibleSmiley closed 1 year ago

InvisibleSmiley commented 1 year ago

When I worked on #27 I missed that the ServiceManagerGetDynamicReturnTypeExtension is actually restricted to ServiceLocatorInterface through getClass(), i.e. it does not support \Interop\Container\ContainerInterface or \Psr\Container\ContainerInterface. Hence, I wrongly updated the README.md documentation (first item under "This extension provides following features:"), too.

This feature request is to add support for letting this extension determine the return type of get() method calls on instances of either \Interop\Container\ContainerInterface or \Psr\Container\ContainerInterface, assuming that they are actually returning a ServiceManager instance.

Hopefully all that needs to be done here is to extract the implementation of ServiceManagerGetDynamicReturnTypeExtension to an abstract base class and then providing three subclasses (one per container type). Didn't check whether the class is covered by tests yet.

Please fix the README.md statement until this issue is resolved.

InvisibleSmiley commented 1 year ago

In case you missed it: Created PR #39 to fix this.