diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php index 88b5cd070e..df55260d8c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php @@ -16,6 +16,7 @@ use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Dependency use Symfony\Component\DependencyInjection\Compiler\CheckTypeDeclarationsPass; use Symfony\Component\DependencyInjection\Compiler\PassConfig; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; use Symfony\Component\HttpKernel\Bundle\Bundle; class TestBundle extends Bundle @@ -24,16 +25,18 @@ class TestBundle extends Bundle { parent::build($container); - $container->setParameter('container.build_hash', 'test_bundle'); - $container->setParameter('container.build_time', time()); - $container->setParameter('container.build_id', 'test_bundle'); - /** @var $extension DependencyInjection\TestExtension */ $extension = $container->getExtension('test'); + if (!$container->getParameterBag() instanceof FrozenParameterBag) { + $container->setParameter('container.build_hash', 'test_bundle'); + $container->setParameter('container.build_time', time()); + $container->setParameter('container.build_id', 'test_bundle'); + } + $extension->setCustomConfig(new CustomConfig()); $container->addCompilerPass(new AnnotationReaderPass(), PassConfig::TYPE_AFTER_REMOVING); - $container->addCompilerPass(new CheckTypeDeclarationsPass(true), PassConfig::TYPE_AFTER_REMOVING, -100); + $container->addCompilerPass(new CheckTypeDeclarationsPass(true, ['http_client', '.debug.http_client']), PassConfig::TYPE_AFTER_REMOVING, -100); } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/JsonLoginLdap/bundles.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/JsonLoginLdap/bundles.php index edf6dae14c..bcfd17425c 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/JsonLoginLdap/bundles.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/JsonLoginLdap/bundles.php @@ -12,5 +12,4 @@ return [ new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), - new Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\TestBundle(), ]; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php index 9bc57539f4..ea4a05cfd9 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php @@ -37,14 +37,16 @@ final class CheckTypeDeclarationsPass extends AbstractRecursivePass private const SCALAR_TYPES = ['int', 'float', 'bool', 'string']; private $autoload; + private $ignoredServices; /** * @param bool $autoload Whether services who's class in not loaded should be checked or not. * Defaults to false to save loading code during compilation. */ - public function __construct(bool $autoload = false) + public function __construct(bool $autoload = false, array $ignoredServices = []) { $this->autoload = $autoload; + $this->ignoredServices = array_flip($ignoredServices); } /** @@ -52,7 +54,7 @@ final class CheckTypeDeclarationsPass extends AbstractRecursivePass */ protected function processValue($value, $isRoot = false) { - if (!$value instanceof Definition) { + if (!$value instanceof Definition || isset($this->ignoredServices[$this->currentId])) { return parent::processValue($value, $isRoot); }