@@ -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
0 commit comments