phpstan-rules icon indicating copy to clipboard operation
phpstan-rules copied to clipboard

Suggestion: Suppress `NoParameterWithContainerTypeDeclarationRule` in a bundle's `loadExtension()`

Open ThomasLandauer opened this issue 3 years ago • 0 comments

When using Symfony's new way to set up a bundle https://symfony.com/doc/current/bundles/extension.html#loading-services-directly-in-your-bundle-class, the following error is emitted by NoParameterWithContainerTypeDeclarationRule:

Method FooBundle\FooBundle::loadExtension() has a parameter $builder with a type declaration of Symfony\Component\DependencyInjection\ContainerBuilder, but containers should not be injected.

I'm suggesting to make an exception for this case, i.e. don't show an error if the method name is xxxBundle::loadExtension()

ThomasLandauer avatar Sep 19 '22 19:09 ThomasLandauer