Skip to content

Commit 68b2b3c

Browse files
committed
[FrameworkBundle] Fix default PHP attributes support in validation and serializer configuration when doctrine/annotations is not installed with PHP 8
1 parent 1b9a792 commit 68b2b3c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

DependencyInjection/Configuration.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e
859859
->{$enableIfStandalone('symfony/validator', Validation::class)}()
860860
->children()
861861
->scalarNode('cache')->end()
862-
->booleanNode('enable_annotations')->{!class_exists(FullStack::class) && $willBeAvailable('doctrine/annotations', Annotation::class, 'symfony/validator') ? 'defaultTrue' : 'defaultFalse'}()->end()
862+
->booleanNode('enable_annotations')->{!class_exists(FullStack::class) && (\PHP_VERSION_ID >= 80000 || $willBeAvailable('doctrine/annotations', Annotation::class, 'symfony/validator')) ? 'defaultTrue' : 'defaultFalse'}()->end()
863863
->arrayNode('static_method')
864864
->defaultValue(['loadValidatorMetadata'])
865865
->prototype('scalar')->end()
@@ -942,8 +942,8 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e
942942

943943
private function addAnnotationsSection(ArrayNodeDefinition $rootNode, callable $willBeAvailable)
944944
{
945-
$doctrineCache = $willBeAvailable('doctrine/cache', Cache::class, 'doctrine/annotation');
946-
$psr6Cache = $willBeAvailable('symfony/cache', PsrCachedReader::class, 'doctrine/annotation');
945+
$doctrineCache = $willBeAvailable('doctrine/cache', Cache::class, 'doctrine/annotations');
946+
$psr6Cache = $willBeAvailable('symfony/cache', PsrCachedReader::class, 'doctrine/annotations');
947947

948948
$rootNode
949949
->children()
@@ -968,7 +968,7 @@ private function addSerializerSection(ArrayNodeDefinition $rootNode, callable $e
968968
->info('serializer configuration')
969969
->{$enableIfStandalone('symfony/serializer', Serializer::class)}()
970970
->children()
971-
->booleanNode('enable_annotations')->{!class_exists(FullStack::class) && $willBeAvailable('doctrine/annotations', Annotation::class, 'symfony/serializer') ? 'defaultTrue' : 'defaultFalse'}()->end()
971+
->booleanNode('enable_annotations')->{!class_exists(FullStack::class) && (\PHP_VERSION_ID >= 80000 || $willBeAvailable('doctrine/annotations', Annotation::class, 'symfony/serializer')) ? 'defaultTrue' : 'defaultFalse'}()->end()
972972
->scalarNode('name_converter')->end()
973973
->scalarNode('circular_reference_handler')->end()
974974
->scalarNode('max_depth_handler')->end()

0 commit comments

Comments
 (0)