-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Second param of ServiceManager::setFactory
doesn't accept a class-string
of a callable class
#159
Comments
Can you probably create a static analysis test in Another question I'd have is: what is the use-case for a dedicated
I can't think about a good reason on why to modify the |
I don't think psalm can document class-string for callable class. |
I don't know that much about that psalm-fu, but using a plain invokable class without implementing |
Yah, no doubts here. Therefore, I guess we have to get a little more But thats not final yet, just want to see if I can find real-world use-cases where it actually makes sense to keep |
FYI: vimeo/psalm#9599 |
Will be fixed with #179 |
Bug Report
Summary
When calling
\Laminas\ServiceManager\ServiceManager::setFactory
the@psalm-param
declaration of the$factory
param requires that theclass-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 implementFactoryInterface
.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.The text was updated successfully, but these errors were encountered: