Skip to content

Commit e35e319

Browse files
[DependencyInjection][FrameworkBundle] Fix precedence of App\Kernel alias and ignore container.excluded tag on synthetic services
1 parent 4c7c326 commit e35e319

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -791,34 +791,34 @@ static function (ChildDefinition $definition, AsPeriodicTask|AsCronTask $attribu
791791
}
792792

793793
$container->registerForAutoconfiguration(CompilerPassInterface::class)
794-
->addTag('container.excluded', ['source' => 'because it\'s a compiler pass'])->setAbstract(true);
794+
->addTag('container.excluded', ['source' => 'because it\'s a compiler pass']);
795795
$container->registerForAutoconfiguration(Constraint::class)
796-
->addTag('container.excluded', ['source' => 'because it\'s a validation constraint'])->setAbstract(true);
796+
->addTag('container.excluded', ['source' => 'because it\'s a validation constraint']);
797797
$container->registerForAutoconfiguration(TestCase::class)
798-
->addTag('container.excluded', ['source' => 'because it\'s a test case'])->setAbstract(true);
798+
->addTag('container.excluded', ['source' => 'because it\'s a test case']);
799799
$container->registerForAutoconfiguration(\UnitEnum::class)
800-
->addTag('container.excluded', ['source' => 'because it\'s an enum'])->setAbstract(true);
800+
->addTag('container.excluded', ['source' => 'because it\'s an enum']);
801801
$container->registerAttributeForAutoconfiguration(AsMessage::class, static function (ChildDefinition $definition) {
802-
$definition->addTag('container.excluded', ['source' => 'because it\'s a messenger message'])->setAbstract(true);
802+
$definition->addTag('container.excluded', ['source' => 'because it\'s a messenger message']);
803803
});
804804
$container->registerAttributeForAutoconfiguration(\Attribute::class, static function (ChildDefinition $definition) {
805-
$definition->addTag('container.excluded', ['source' => 'because it\'s an attribute'])->setAbstract(true);
805+
$definition->addTag('container.excluded', ['source' => 'because it\'s a PHP attribute']);
806806
});
807807
$container->registerAttributeForAutoconfiguration(Entity::class, static function (ChildDefinition $definition) {
808-
$definition->addTag('container.excluded', ['source' => 'because it\'s a doctrine entity'])->setAbstract(true);
808+
$definition->addTag('container.excluded', ['source' => 'because it\'s a Doctrine entity']);
809809
});
810810
$container->registerAttributeForAutoconfiguration(Embeddable::class, static function (ChildDefinition $definition) {
811-
$definition->addTag('container.excluded', ['source' => 'because it\'s a doctrine embeddable'])->setAbstract(true);
811+
$definition->addTag('container.excluded', ['source' => 'because it\'s a Doctrine embeddable']);
812812
});
813813
$container->registerAttributeForAutoconfiguration(MappedSuperclass::class, static function (ChildDefinition $definition) {
814-
$definition->addTag('container.excluded', ['source' => 'because it\'s a doctrine mapped superclass'])->setAbstract(true);
814+
$definition->addTag('container.excluded', ['source' => 'because it\'s a Doctrine mapped superclass']);
815815
});
816816

817817
$container->registerAttributeForAutoconfiguration(JsonStreamable::class, static function (ChildDefinition $definition, JsonStreamable $attribute) {
818818
$definition->addTag('json_streamer.streamable', [
819819
'object' => $attribute->asObject,
820820
'list' => $attribute->asList,
821-
])->addTag('container.excluded', ['source' => 'because it\'s a streamable JSON'])->setAbstract(true);
821+
])->addTag('container.excluded', ['source' => 'because it\'s a streamable JSON']);
822822
});
823823

824824
if (!$container->getParameter('kernel.debug')) {

Kernel/MicroKernelTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
165165
->setPublic(true)
166166
;
167167
}
168-
$container->setAlias($kernelClass, 'kernel')->setPublic(true);
169168

170169
$kernelDefinition = $container->getDefinition('kernel');
171170
$kernelDefinition->addTag('routing.route_loader');
@@ -198,6 +197,8 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
198197
$kernelLoader->registerAliasesForSinglyImplementedInterfaces();
199198
AbstractConfigurator::$valuePreProcessor = $valuePreProcessor;
200199
}
200+
201+
$container->setAlias($kernelClass, 'kernel')->setPublic(true);
201202
});
202203
}
203204

0 commit comments

Comments
 (0)