Skip to content

Commit b45e13e

Browse files
committed
[FrameworkBundle] Configure PHP Attributes without doctrine/annotations.
1 parent 2c39acd commit b45e13e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -965,11 +965,11 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co
965965
->replaceArgument(0, $config['default_uri']);
966966
}
967967

968-
if ($this->annotationsConfigEnabled) {
968+
if (\PHP_VERSION_ID >= 80000 || $this->annotationsConfigEnabled) {
969969
$container->register('routing.loader.annotation', AnnotatedRouteControllerLoader::class)
970970
->setPublic(false)
971971
->addTag('routing.loader', ['priority' => -10])
972-
->addArgument(new Reference('annotation_reader'));
972+
->addArgument(new Reference('annotation_reader', ContainerInterface::NULL_ON_INVALID_REFERENCE));
973973

974974
$container->register('routing.loader.annotation.directory', AnnotationDirectoryLoader::class)
975975
->setPublic(false)
@@ -1564,13 +1564,13 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
15641564

15651565
$serializerLoaders = [];
15661566
if (isset($config['enable_annotations']) && $config['enable_annotations']) {
1567-
if (!$this->annotationsConfigEnabled) {
1567+
if (\PHP_VERSION_ID < 80000 && !$this->annotationsConfigEnabled) {
15681568
throw new \LogicException('"enable_annotations" on the serializer cannot be set as Annotations support is disabled.');
15691569
}
15701570

15711571
$annotationLoader = new Definition(
15721572
'Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader',
1573-
[new Reference('annotation_reader')]
1573+
[new Reference('annotation_reader', ContainerInterface::NULL_ON_INVALID_REFERENCE)]
15741574
);
15751575
$annotationLoader->setPublic(false);
15761576

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ public function testSerializerMapping()
12321232
$projectDir = $container->getParameter('kernel.project_dir');
12331233
$configDir = __DIR__.'/Fixtures/TestBundle/Resources/config';
12341234
$expectedLoaders = [
1235-
new Definition(AnnotationLoader::class, [new Reference('annotation_reader')]),
1235+
new Definition(AnnotationLoader::class, [new Reference('annotation_reader', ContainerInterface::NULL_ON_INVALID_REFERENCE)]),
12361236
new Definition(XmlFileLoader::class, [$configDir.'/serialization.xml']),
12371237
new Definition(YamlFileLoader::class, [$configDir.'/serialization.yml']),
12381238
new Definition(YamlFileLoader::class, [$projectDir.'/config/serializer/foo.yml']),

src/Symfony/Bundle/FrameworkBundle/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"symfony/polyfill-php80": "^1.15",
3030
"symfony/filesystem": "^4.4|^5.0",
3131
"symfony/finder": "^4.4|^5.0",
32-
"symfony/routing": "^5.1"
32+
"symfony/routing": "^5.2"
3333
},
3434
"require-dev": {
3535
"doctrine/annotations": "~1.7",

0 commit comments

Comments
 (0)