4343use Symfony \Component \Cache \Adapter \ChainAdapter ;
4444use Symfony \Component \Cache \Adapter \TagAwareAdapter ;
4545use Symfony \Component \Cache \DependencyInjection \CachePoolPass ;
46- use Symfony \Component \Cache \Marshaller \MarshallerInterface ;
47- use Symfony \Component \Cache \ResettableInterface ;
4846use Symfony \Component \Clock \ClockInterface ;
4947use Symfony \Component \Config \Definition \ConfigurationInterface ;
5048use Symfony \Component \Config \FileLocator ;
5553use Symfony \Component \Console \Application ;
5654use Symfony \Component \Console \Attribute \AsCommand ;
5755use Symfony \Component \Console \Command \Command ;
58- use Symfony \Component \Console \DataCollector \CommandDataCollector ;
59- use Symfony \Component \Console \Debug \CliRequest ;
6056use Symfony \Component \Console \Messenger \RunCommandMessageHandler ;
6157use Symfony \Component \DependencyInjection \Alias ;
6258use Symfony \Component \DependencyInjection \Argument \ArgumentTrait ;
8379use Symfony \Component \Filesystem \Filesystem ;
8480use Symfony \Component \Finder \Finder ;
8581use Symfony \Component \Finder \Glob ;
86- use Symfony \Component \Form \EnumFormTypeGuesser ;
8782use Symfony \Component \Form \Form ;
8883use Symfony \Component \Form \FormTypeExtensionInterface ;
8984use Symfony \Component \Form \FormTypeGuesserInterface ;
106101use Symfony \Component \HttpKernel \DataCollector \DataCollectorInterface ;
107102use Symfony \Component \HttpKernel \DependencyInjection \Extension ;
108103use Symfony \Component \HttpKernel \Log \DebugLoggerConfigurator ;
109- use Symfony \Component \HttpKernel \Profiler \ProfilerStateChecker ;
110104use Symfony \Component \JsonStreamer \Attribute \JsonStreamable ;
111105use Symfony \Component \JsonStreamer \JsonStreamWriter ;
112106use Symfony \Component \JsonStreamer \StreamReaderInterface ;
123117use Symfony \Component \Messenger \Attribute \AsMessage ;
124118use Symfony \Component \Messenger \Attribute \AsMessageHandler ;
125119use Symfony \Component \Messenger \Bridge as MessengerBridge ;
126- use Symfony \Component \Messenger \EventListener \ResetMemoryUsageListener ;
127120use Symfony \Component \Messenger \Handler \BatchHandlerInterface ;
128121use Symfony \Component \Messenger \MessageBus ;
129122use Symfony \Component \Messenger \MessageBusInterface ;
130- use Symfony \Component \Messenger \Middleware \DeduplicateMiddleware ;
131123use Symfony \Component \Messenger \Middleware \RouterContextMiddleware ;
132124use Symfony \Component \Messenger \Transport \Serialization \SerializerInterface ;
133125use Symfony \Component \Messenger \Transport \TransportFactoryInterface as MessengerTransportFactoryInterface ;
164156use Symfony \Component \RemoteEvent \Attribute \AsRemoteEventConsumer ;
165157use Symfony \Component \RemoteEvent \RemoteEvent ;
166158use Symfony \Component \Routing \Attribute \Route ;
167- use Symfony \Component \Routing \Loader \AttributeServicesLoader ;
168159use Symfony \Component \Scheduler \Attribute \AsCronTask ;
169160use Symfony \Component \Scheduler \Attribute \AsPeriodicTask ;
170161use Symfony \Component \Scheduler \Attribute \AsSchedule ;
171162use Symfony \Component \Scheduler \Messenger \SchedulerTransportFactory ;
172- use Symfony \Component \Scheduler \Messenger \Serializer \Normalizer \SchedulerTriggerNormalizer ;
173163use Symfony \Component \Security \Core \AuthenticationEvents ;
174164use Symfony \Component \Security \Core \Exception \AuthenticationException ;
175165use Symfony \Component \Security \Csrf \CsrfToken ;
179169use Symfony \Component \Semaphore \SemaphoreFactory ;
180170use Symfony \Component \Semaphore \Store \StoreFactory as SemaphoreStoreFactory ;
181171use Symfony \Component \Serializer \Attribute as SerializerMapping ;
182- use Symfony \Component \Serializer \DependencyInjection \AttributeMetadataPass as SerializerAttributeMetadataPass ;
183172use Symfony \Component \Serializer \Encoder \DecoderInterface ;
184173use Symfony \Component \Serializer \Encoder \EncoderInterface ;
185174use Symfony \Component \Serializer \Mapping \Loader \XmlFileLoader ;
205194use Symfony \Component \Uid \UuidV4 ;
206195use Symfony \Component \Validator \Constraint ;
207196use Symfony \Component \Validator \Constraints \ExpressionLanguageProvider ;
208- use Symfony \Component \Validator \Constraints \Traverse ;
209197use Symfony \Component \Validator \ConstraintValidatorInterface ;
210- use Symfony \Component \Validator \DependencyInjection \AttributeMetadataPass as ValidatorAttributeMetadataPass ;
211198use Symfony \Component \Validator \GroupProviderInterface ;
212199use Symfony \Component \Validator \Mapping \Loader \PropertyInfoLoader ;
213200use Symfony \Component \Validator \ObjectInitializerInterface ;
@@ -676,12 +663,6 @@ public function load(array $configs, ContainerBuilder $container): void
676663 ->addTag ('kernel.locale_aware ' );
677664 $ container ->registerForAutoconfiguration (ResetInterface::class)
678665 ->addTag ('kernel.reset ' , ['method ' => 'reset ' ]);
679-
680- if (!interface_exists (MarshallerInterface::class)) {
681- $ container ->registerForAutoconfiguration (ResettableInterface::class)
682- ->addTag ('kernel.reset ' , ['method ' => 'reset ' ]);
683- }
684-
685666 $ container ->registerForAutoconfiguration (PropertyListExtractorInterface::class)
686667 ->addTag ('property_info.list_extractor ' );
687668 $ container ->registerForAutoconfiguration (PropertyTypeExtractorInterface::class)
@@ -843,10 +824,6 @@ private function registerFormConfiguration(array $config, ContainerBuilder $cont
843824 {
844825 $ loader ->load ('form.php ' );
845826
846- if (!class_exists (EnumFormTypeGuesser::class)) {
847- $ container ->removeDefinition ('form.type_guesser.enum_type ' );
848- }
849-
850827 if (null === $ config ['form ' ]['csrf_protection ' ]['enabled ' ]) {
851828 $ this ->writeConfigEnabled ('form.csrf_protection ' , $ config ['csrf_protection ' ]['enabled ' ], $ config ['form ' ]['csrf_protection ' ]);
852829 }
@@ -945,11 +922,6 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
945922 $ loader ->load ('collectors.php ' );
946923 $ loader ->load ('cache_debug.php ' );
947924
948- if (!class_exists (ProfilerStateChecker::class)) {
949- $ container ->removeDefinition ('profiler.state_checker ' );
950- $ container ->removeDefinition ('profiler.is_disabled_state_checker ' );
951- }
952-
953925 if ($ this ->isInitializedConfigEnabled ('form ' )) {
954926 $ loader ->load ('form_debug.php ' );
955927 }
@@ -1006,13 +978,9 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
1006978 $ container ->getDefinition ('profiler_listener ' )
1007979 ->addArgument ($ config ['collect_parameter ' ]);
1008980
1009- if (!$ container ->getParameter ('kernel.debug ' ) || !class_exists (CliRequest::class) || ! $ container ->has ('debug.stopwatch ' )) {
981+ if (!$ container ->getParameter ('kernel.debug ' ) || !$ container ->has ('debug.stopwatch ' )) {
1010982 $ container ->removeDefinition ('console_profiler_listener ' );
1011983 }
1012-
1013- if (!class_exists (CommandDataCollector::class)) {
1014- $ container ->removeDefinition ('.data_collector.command ' );
1015- }
1016984 }
1017985
1018986 private function registerWorkflowConfiguration (array $ config , ContainerBuilder $ container , PhpFileLoader $ loader ): void
@@ -1270,10 +1238,6 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co
12701238
12711239 $ loader ->load ('routing.php ' );
12721240
1273- if (!class_exists (AttributeServicesLoader::class)) {
1274- $ container ->removeDefinition ('routing.loader.attribute.services ' );
1275- }
1276-
12771241 if ($ config ['utf8 ' ]) {
12781242 $ container ->getDefinition ('routing.loader ' )->replaceArgument (1 , ['utf8 ' => true ]);
12791243 }
@@ -1766,7 +1730,7 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
17661730
17671731 // When attributes are disabled, it means from runtime-discovery only; autoconfiguration should still happen.
17681732 // And when runtime-discovery of attributes is enabled, we can skip compile-time autoconfiguration in debug mode.
1769- if (class_exists (ValidatorAttributeMetadataPass::class) && ( !($ config ['enable_attributes ' ] ?? false ) || !$ container ->getParameter ('kernel.debug ' )) && trait_exists (ArgumentTrait::class )) {
1733+ if (!($ config ['enable_attributes ' ] ?? false ) || !$ container ->getParameter ('kernel.debug ' )) {
17701734 // The $reflector argument hints at where the attribute could be used
17711735 $ container ->registerAttributeForAutoconfiguration (Constraint::class, function (ChildDefinition $ definition , Constraint $ attribute , \ReflectionClass |\ReflectionMethod |\ReflectionProperty $ reflector ) {
17721736 $ definition ->addTag ('validator.attribute_metadata ' );
@@ -1818,9 +1782,6 @@ private function registerValidatorMapping(ContainerBuilder $container, array $co
18181782
18191783 if (!ContainerBuilder::willBeAvailable ('symfony/form ' , Form::class, ['symfony/framework-bundle ' , 'symfony/validator ' ])) {
18201784 $ container ->removeDefinition ('validator.form.attribute_metadata ' );
1821- } elseif (!($ r = new \ReflectionClass (Form::class))->getAttributes (Traverse::class) || !class_exists (ValidatorAttributeMetadataPass::class)) {
1822- // BC with symfony/form & symfony/validator < 7.4
1823- $ fileRecorder ('xml ' , \dirname ($ r ->getFileName ()).'/Resources/config/validation.xml ' );
18241785 }
18251786
18261787 foreach ($ container ->getParameter ('kernel.bundles_metadata ' ) as $ bundle ) {
@@ -2016,7 +1977,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
20161977
20171978 // When attributes are disabled, it means from runtime-discovery only; autoconfiguration should still happen.
20181979 // And when runtime-discovery of attributes is enabled, we can skip compile-time autoconfiguration in debug mode.
2019- if (class_exists (SerializerAttributeMetadataPass::class) && ( !($ config ['enable_attributes ' ] ?? false ) || !$ container ->getParameter ('kernel.debug ' ) )) {
1980+ if (!($ config ['enable_attributes ' ] ?? false ) || !$ container ->getParameter ('kernel.debug ' )) {
20201981 // The $reflector argument hints at where the attribute could be used
20211982 $ configurator = function (ChildDefinition $ definition , object $ attribute , \ReflectionClass |\ReflectionMethod |\ReflectionProperty $ reflector ) {
20221983 $ definition ->addTag ('serializer.attribute_metadata ' );
@@ -2037,15 +1998,10 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
20371998 });
20381999 }
20392000
2040- if (($ config ['enable_attributes ' ] ?? false ) || class_exists (SerializerAttributeMetadataPass::class)) {
2041- $ serializerLoaders [] = new Reference ('serializer.mapping.attribute_loader ' );
2001+ $ serializerLoaders [] = new Reference ('serializer.mapping.attribute_loader ' );
20422002
2043- $ container ->getDefinition ('serializer.mapping.attribute_loader ' )
2044- ->replaceArgument (0 , $ config ['enable_attributes ' ] ?? false );
2045- } else {
2046- // BC with symfony/serializer < 7.4
2047- $ container ->removeDefinition ('serializer.mapping.attribute_services_loader ' );
2048- }
2003+ $ container ->getDefinition ('serializer.mapping.attribute_loader ' )
2004+ ->replaceArgument (0 , $ config ['enable_attributes ' ] ?? false );
20492005
20502006 $ fileRecorder = function ($ extension , $ path ) use (&$ serializerLoaders ) {
20512007 $ definition = new Definition (\in_array ($ extension , ['yaml ' , 'yml ' ], true ) ? YamlFileLoader::class : XmlFileLoader::class, [$ path ]);
@@ -2289,11 +2245,6 @@ private function registerSchedulerConfiguration(ContainerBuilder $container, Php
22892245 if (!$ this ->hasConsole ()) {
22902246 $ container ->removeDefinition ('console.command.scheduler_debug ' );
22912247 }
2292-
2293- // BC layer Scheduler < 7.3
2294- if (!ContainerBuilder::willBeAvailable ('symfony/serializer ' , DenormalizerInterface::class, ['symfony/framework-bundle ' , 'symfony/scheduler ' ]) || !class_exists (SchedulerTriggerNormalizer::class)) {
2295- $ container ->removeDefinition ('serializer.normalizer.scheduler_trigger ' );
2296- }
22972248 }
22982249
22992250 private function registerMessengerConfiguration (array $ config , ContainerBuilder $ container , PhpFileLoader $ loader , bool $ validationEnabled , bool $ lockEnabled ): void
@@ -2312,10 +2263,6 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
23122263 $ container ->removeDefinition ('serializer.normalizer.flatten_exception ' );
23132264 }
23142265
2315- if (!class_exists (ResetMemoryUsageListener::class)) {
2316- $ container ->removeDefinition ('messenger.listener.reset_memory_usage ' );
2317- }
2318-
23192266 if (ContainerBuilder::willBeAvailable ('symfony/amqp-messenger ' , MessengerBridge \Amqp \Transport \AmqpTransportFactory::class, ['symfony/framework-bundle ' , 'symfony/messenger ' ])) {
23202267 $ container ->getDefinition ('messenger.transport.amqp.factory ' )->addTag ('messenger.transport_factory ' );
23212268 }
@@ -2356,7 +2303,7 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
23562303 ],
23572304 ];
23582305
2359- if ($ lockEnabled && class_exists (DeduplicateMiddleware::class) && class_exists ( LockFactory::class)) {
2306+ if ($ lockEnabled && class_exists (LockFactory::class)) {
23602307 $ defaultMiddleware ['before ' ][] = ['id ' => 'deduplicate_middleware ' ];
23612308 } else {
23622309 $ container ->removeDefinition ('messenger.middleware.deduplicate_middleware ' );
0 commit comments