laminas-servicemanager icon indicating copy to clipboard operation
laminas-servicemanager copied to clipboard

Second param of `ServiceManager::setFactory` doesn't accept a `class-string` of a callable class

Open rieschl opened this issue 2 years ago • 0 comments

Bug Report

Q A
Version(s) 3.17.0

Summary

When calling \Laminas\ServiceManager\ServiceManager::setFactory the @psalm-param declaration of the $factory param requires that the class-string implements the \Laminas\ServiceManager\Factory\FactoryInterface. The service manager also accepts a plain callable, though.

Current behavior

PHPStan complains that the class-string of the class doesn't implement FactoryInterface.

How to reproduce

Try to pass a callable class to setFactory and run PHPStan.

Expected behavior

The method should accept a plain callable class. Psalm and PHPStan don't accept class-string<callable>, though.

rieschl avatar Oct 21 '22 09:10 rieschl