Skip to content

Commit 3caa9d4

Browse files
feature symfony#28416 [FrameworkBundle] bind "ContainerInterface $parameterBag" arguments to the "parameter_bag" service (nicolas-grekas)
This PR was merged into the 4.2-dev branch. Discussion ---------- [FrameworkBundle] bind "ContainerInterface $parameterBag" arguments to the "parameter_bag" service | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 2c428d1 [FrameworkBundle] bind "ContainerInterface $parameterBag" arguments to the "parameter_bag" service
2 parents 36be979 + 2c428d1 commit 3caa9d4

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\Common\Annotations\AnnotationRegistry;
1515
use Doctrine\Common\Annotations\Reader;
1616
use Psr\Cache\CacheItemPoolInterface;
17+
use Psr\Container\ContainerInterface as PsrContainerInterface;
1718
use Psr\Log\LoggerAwareInterface;
1819
use Symfony\Bridge\Monolog\Processor\DebugProcessor;
1920
use Symfony\Bridge\Monolog\Processor\ProcessorInterface;
@@ -46,8 +47,6 @@
4647
use Symfony\Component\DependencyInjection\Exception\LogicException;
4748
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
4849
use Symfony\Component\DependencyInjection\Parameter;
49-
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;
50-
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
5150
use Symfony\Component\DependencyInjection\Reference;
5251
use Symfony\Component\DependencyInjection\ServiceLocator;
5352
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -133,11 +132,7 @@ public function load(array $configs, ContainerBuilder $container)
133132
$loader->load('services.xml');
134133
$loader->load('fragment_renderer.xml');
135134

136-
if (!interface_exists(ContainerBagInterface::class)) {
137-
$container->removeDefinition('parameter_bag');
138-
$container->removeAlias(ContainerBagInterface::class);
139-
$container->removeAlias(ParameterBagInterface::class);
140-
}
135+
$container->registerAliasForArgument('parameter_bag', PsrContainerInterface::class);
141136

142137
if (class_exists(Application::class)) {
143138
$loader->load('console.xml');
@@ -715,12 +710,6 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co
715710
if ($config['utf8']) {
716711
$container->getDefinition('routing.loader')->replaceArgument(2, array('utf8' => true));
717712
}
718-
if (!interface_exists(ContainerBagInterface::class)) {
719-
$container->getDefinition('router.default')
720-
->replaceArgument(0, new Reference('service_container'))
721-
->clearTag('container.service_subscriber')
722-
;
723-
}
724713

725714
$container->setParameter('router.resource', $config['resource']);
726715
$container->setParameter('router.cache_class_prefix', $container->getParameter('kernel.container_class'));

0 commit comments

Comments
 (0)