phpstan-rules
phpstan-rules copied to clipboard
Suggestion: Suppress `NoParameterWithContainerTypeDeclarationRule` in a bundle's `loadExtension()`
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()