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
Hello,
Since #192 (fix #191), the return type for ParameterBagInterface::get() works with dependency injection but not with ServiceSubscriberInterface :
ParameterBagInterface::get()
ServiceSubscriberInterface
namespace App\Issue; use Psr\Container\ContainerInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Contracts\Service\ServiceSubscriberInterface; class Issue implements ServiceSubscriberInterface { public function __construct(protected ContainerInterface $container, protected ParameterBagInterface $parameterBag) { } public function test(): void { $parameterBagFromConstructor = $this->parameterBag; // Expected: Dumped type: Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface // Observed: Dumped type: Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface \PHPStan\dumpType($parameterBagFromConstructor); $parameterBagFromContainer = $this->container->get(ParameterBagInterface::class); // Expected: Dumped type: Symfony\Component\DependencyInjection\ParameterBag\ContainerBag // Observed: Dumped type: Symfony\Component\DependencyInjection\ParameterBag\ContainerBag \PHPStan\dumpType($parameterBagFromContainer); $parameterFromConstructor = $parameterBagFromConstructor->get('kernel.project_dir'); // Expected: Dumped type: string // Observed: Dumped type: string \PHPStan\dumpType($parameterFromConstructor); $parameterFromContainer = $parameterBagFromContainer->get('kernel.project_dir'); // Expected: Dumped type: string // Observed: Dumped type: array|bool|float|int|string|UnitEnum|null \PHPStan\dumpType($parameterFromContainer); } public static function getSubscribedServices(): array { return [ ParameterBagInterface::class, ]; } }
Is there a solution for add the support of ParameterBagInterface::get() with ServiceSubscriberInterface ?
Thanks
The text was updated successfully, but these errors were encountered:
Same issues with ServiceLocators https://symfony.com/doc/current/service_container/service_subscribers_locators.html#defining-a-service-locator
Sorry, something went wrong.
No branches or pull requests
Hello,
Since #192 (fix #191), the return type for
ParameterBagInterface::get()
works with dependency injection but not withServiceSubscriberInterface
:Is there a solution for add the support of
ParameterBagInterface::get()
withServiceSubscriberInterface
?Thanks
The text was updated successfully, but these errors were encountered: