We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I often create what I call "static factories" along the lines of
class SomeFactory { public function __construct(private string $key) { } public static function __callStatic(string $method, array $arguments): Whatever { $container = $arguments[0] ?? null; assert($container instanceof ContainerInterface); return (new self($method))->__invoke($container); } public function __invoke(ContainerInterface $container): Whatever { $config = $this->key; return new Whatever( $container->get(SomeDependency::class) $config, ); } }
and then refer to these in config as:
return [ 'factories' => [ Whatever::class => [SomeFactory::class, 'some-key'], ], ];
Adding callables like this is causing SA issues in projects
No SA issues listing regular callables
…
Can we simply add callable to the psalm-type unions on ServiceManager for factories, delegators etc?
callable
ServiceManager
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Bug Report
Summary
I often create what I call "static factories" along the lines of
and then refer to these in config as:
Current behavior
Adding callables like this is causing SA issues in projects
Expected behavior
No SA issues listing regular callables
…
Can we simply add
callable
to the psalm-type unions onServiceManager
for factories, delegators etc?The text was updated successfully, but these errors were encountered: