Skip to content

Commit 1326d30

Browse files
Merge branch '4.4' into 5.4
* 4.4: [FrameworkBundle] fix tests [FrameworkBundle] fix wiring of annotations.cached_reader Fix BC break
2 parents 8a249d1 + 6eee263 commit 1326d30

File tree

8 files changed

+15
-12
lines changed

8 files changed

+15
-12
lines changed

Command/AbstractConfigCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\Console\Helper\Table;
1717
use Symfony\Component\Console\Output\OutputInterface;
1818
use Symfony\Component\Console\Style\StyleInterface;
19-
use Symfony\Component\DependencyInjection\ContainerBuilder;
2019
use Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface;
2120
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
2221

@@ -61,7 +60,7 @@ protected function listBundles($output)
6160
/**
6261
* @return ExtensionInterface
6362
*/
64-
protected function findExtension(string $name, ContainerBuilder $container)
63+
protected function findExtension(string $name)
6564
{
6665
$bundles = $this->initializeBundles();
6766
$minScore = \INF;
@@ -99,6 +98,8 @@ protected function findExtension(string $name, ContainerBuilder $container)
9998
}
10099
}
101100

101+
$container = $this->getContainerBuilder();
102+
102103
if ($container->hasExtension($name)) {
103104
return $container->getExtension($name);
104105
}

Command/ConfigDebugCommand.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9292
return 0;
9393
}
9494

95-
$container = $this->compileContainer();
96-
$extension = $this->findExtension($name, $container);
95+
$extension = $this->findExtension($name);
9796
$extensionAlias = $extension->getAlias();
97+
$container = $this->compileContainer();
9898

9999
$config = $this->getConfig($extension, $container);
100100

@@ -197,8 +197,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
197197

198198
if ($input->mustSuggestArgumentValuesFor('path') && null !== $name = $input->getArgument('name')) {
199199
try {
200-
$container = $this->compileContainer();
201-
$config = $this->getConfig($this->findExtension($name, $container), $container);
200+
$config = $this->getConfig($this->findExtension($name), $this->compileContainer());
202201
$paths = array_keys(self::buildPathsCompletion($config));
203202
$suggestions->suggestValues($paths);
204203
} catch (LogicException $e) {

Command/ConfigDumpReferenceCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
105105
return 0;
106106
}
107107

108-
$container = $this->getContainerBuilder($this->getApplication()->getKernel());
109-
$extension = $this->findExtension($name, $container);
108+
$extension = $this->findExtension($name);
110109

111110
if ($extension instanceof ConfigurationInterface) {
112111
$configuration = $extension;
113112
} else {
114-
$configuration = $extension->getConfiguration([], $container);
113+
$configuration = $extension->getConfiguration([], $this->getContainerBuilder());
115114
}
116115

117116
$this->validateConfiguration($extension, $configuration);

DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public function process(ContainerBuilder $container)
2929
// "annotation_reader" at build time don't get any cache
3030
foreach ($container->findTaggedServiceIds('annotations.cached_reader') as $id => $tags) {
3131
$reader = $container->getDefinition($id);
32-
$reader->setPublic(false);
3332
$properties = $reader->getProperties();
3433

3534
if (isset($properties['cacheProviderBackup'])) {

DependencyInjection/Compiler/UnusedTagsPass.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class UnusedTagsPass implements CompilerPassInterface
3030
'chatter.transport_factory',
3131
'config_cache.resource_checker',
3232
'console.command',
33+
'container.do_not_inline',
3334
'container.env_var_loader',
3435
'container.env_var_processor',
3536
'container.hot_path',

DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,8 @@ public function load(array $configs, ContainerBuilder $container)
634634
->addTag('routing.route_loader');
635635

636636
$container->setParameter('container.behavior_describing_tags', [
637+
'annotations.cached_reader',
638+
'container.do_not_inline',
637639
'container.service_locator',
638640
'container.service_subscriber',
639641
'kernel.event_subscriber',
@@ -1661,11 +1663,9 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
16611663

16621664
$container
16631665
->getDefinition('annotations.cached_reader')
1664-
->setPublic(true) // set to false in AddAnnotationsCachedReaderPass
16651666
->replaceArgument(2, $config['debug'])
16661667
// reference the cache provider without using it until AddAnnotationsCachedReaderPass runs
16671668
->addArgument(new ServiceClosureArgument(new Reference($cacheService)))
1668-
->addTag('annotations.cached_reader')
16691669
;
16701670

16711671
$container->setAlias('annotation_reader', 'annotations.cached_reader');

Resources/config/annotations.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
inline_service(ArrayAdapter::class),
3939
abstract_arg('Debug-Flag'),
4040
])
41+
->tag('annotations.cached_reader')
42+
->tag('container.do_not_inline')
4143

4244
->set('annotations.filesystem_cache_adapter', FilesystemAdapter::class)
4345
->args([

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,6 +1969,8 @@ public function testRegisterParameterCollectingBehaviorDescribingTags()
19691969

19701970
$this->assertTrue($container->hasParameter('container.behavior_describing_tags'));
19711971
$this->assertEquals([
1972+
'annotations.cached_reader',
1973+
'container.do_not_inline',
19721974
'container.service_locator',
19731975
'container.service_subscriber',
19741976
'kernel.event_subscriber',

0 commit comments

Comments
 (0)