Closed roquie closed 6 years ago
@roquie If you are using default service locator provided with the library you can safely use all the methods that exist within it. Just add docblock and typehint property accordingly:
<?php
class MyModule implements ServiceProvider
{
/**
* @param ServiceLocator $container
*/
public function provideServices(ContainerInterface $container): void
{
$container->share(...);
}
}
Sadly php is not supporting generics yet, thats why I had to use PSR container interface.
I had no better idea for this interface, if you have any better I will be glad if you can share it here :)
Yes, I came back to tell about docblock and close issue :)
Thanks!
Maybe change docblock in the interface code of ServiceProvider
? For a better understanding of course.
Igni\Application\Providers\ServiceProvider
has one method with PSR ContainerInterface and I can't register additional there services becausehas
andget
methods not enough for this.My goal is a create the re-usable module for PDO connection:
But it's impossible with the current ServiceProvider interface. Or I'm wrong?