Skip to content

Commit 04ac136

Browse files
Merge branch '5.4' into 6.0
* 5.4: Fix merge [FrameworkBundle] fix tests [FrameworkBundle] fix wiring of annotations.cached_reader [SecurityBundle] Remove dead `class_exists` checks Fix BC break [DependencyInjection] Ignore unused bindings defined by attribute [ErrorHandler] update tentative types
2 parents f169d0c + b5ef993 commit 04ac136

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

@@ -55,7 +54,7 @@ protected function listBundles(OutputInterface|StyleInterface $output)
5554
}
5655
}
5756

58-
protected function findExtension(string $name, ContainerBuilder $container): ExtensionInterface
57+
protected function findExtension(string $name): ExtensionInterface
5958
{
6059
$bundles = $this->initializeBundles();
6160
$minScore = \INF;
@@ -93,6 +92,8 @@ protected function findExtension(string $name, ContainerBuilder $container): Ext
9392
}
9493
}
9594

95+
$container = $this->getContainerBuilder();
96+
9697
if ($container->hasExtension($name)) {
9798
return $container->getExtension($name);
9899
}

Command/ConfigDebugCommand.php

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

93-
$container = $this->compileContainer();
94-
$extension = $this->findExtension($name, $container);
93+
$extension = $this->findExtension($name);
9594
$extensionAlias = $extension->getAlias();
95+
$container = $this->compileContainer();
9696

9797
$config = $this->getConfig($extension, $container);
9898

@@ -193,8 +193,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
193193

194194
if ($input->mustSuggestArgumentValuesFor('path') && null !== $name = $input->getArgument('name')) {
195195
try {
196-
$container = $this->compileContainer();
197-
$config = $this->getConfig($this->findExtension($name, $container), $container);
196+
$config = $this->getConfig($this->findExtension($name), $this->compileContainer());
198197
$paths = array_keys(self::buildPathsCompletion($config));
199198
$suggestions->suggestValues($paths);
200199
} catch (LogicException $e) {

Command/ConfigDumpReferenceCommand.php

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

106-
$container = $this->getContainerBuilder($this->getApplication()->getKernel());
107-
$extension = $this->findExtension($name, $container);
106+
$extension = $this->findExtension($name);
108107

109108
if ($extension instanceof ConfigurationInterface) {
110109
$configuration = $extension;
111110
} else {
112-
$configuration = $extension->getConfiguration([], $container);
111+
$configuration = $extension->getConfiguration([], $this->getContainerBuilder($this->getApplication()->getKernel()));
113112
}
114113

115114
$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
@@ -621,6 +621,8 @@ public function load(array $configs, ContainerBuilder $container)
621621
->addTag('routing.route_loader');
622622

623623
$container->setParameter('container.behavior_describing_tags', [
624+
'annotations.cached_reader',
625+
'container.do_not_inline',
624626
'container.service_locator',
625627
'container.service_subscriber',
626628
'kernel.event_subscriber',
@@ -1594,11 +1596,9 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
15941596

15951597
$container
15961598
->getDefinition('annotations.cached_reader')
1597-
->setPublic(true) // set to false in AddAnnotationsCachedReaderPass
15981599
->replaceArgument(2, $config['debug'])
15991600
// reference the cache provider without using it until AddAnnotationsCachedReaderPass runs
16001601
->addArgument(new ServiceClosureArgument(new Reference($cacheService)))
1601-
->addTag('annotations.cached_reader')
16021602
;
16031603

16041604
$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
@@ -37,6 +37,8 @@
3737
inline_service(ArrayAdapter::class),
3838
abstract_arg('Debug-Flag'),
3939
])
40+
->tag('annotations.cached_reader')
41+
->tag('container.do_not_inline')
4042

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

Tests/DependencyInjection/FrameworkExtensionTest.php

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

18571857
$this->assertTrue($container->hasParameter('container.behavior_describing_tags'));
18581858
$this->assertEquals([
1859+
'annotations.cached_reader',
1860+
'container.do_not_inline',
18591861
'container.service_locator',
18601862
'container.service_subscriber',
18611863
'kernel.event_subscriber',

0 commit comments

Comments
 (0)