41
41
use Symfony \Component \Cache \Adapter \ChainAdapter ;
42
42
use Symfony \Component \Cache \Adapter \TagAwareAdapter ;
43
43
use Symfony \Component \Cache \DependencyInjection \CachePoolPass ;
44
- use Symfony \Component \Cache \Marshaller \DefaultMarshaller ;
45
44
use Symfony \Component \Cache \Marshaller \MarshallerInterface ;
46
45
use Symfony \Component \Cache \ResettableInterface ;
47
46
use Symfony \Component \Clock \ClockInterface ;
75
74
use Symfony \Component \ExpressionLanguage \ExpressionLanguage ;
76
75
use Symfony \Component \Finder \Finder ;
77
76
use Symfony \Component \Finder \Glob ;
78
- use Symfony \Component \Form \ChoiceList \Factory \CachingFactoryDecorator ;
79
77
use Symfony \Component \Form \Extension \HtmlSanitizer \Type \TextTypeHtmlSanitizerExtension ;
80
78
use Symfony \Component \Form \Form ;
81
79
use Symfony \Component \Form \FormTypeExtensionInterface ;
95
93
use Symfony \Component \HttpKernel \Attribute \AsTargetedValueResolver ;
96
94
use Symfony \Component \HttpKernel \CacheClearer \CacheClearerInterface ;
97
95
use Symfony \Component \HttpKernel \CacheWarmer \CacheWarmerInterface ;
98
- use Symfony \Component \HttpKernel \Controller \ArgumentResolver \BackedEnumValueResolver ;
99
- use Symfony \Component \HttpKernel \Controller \ArgumentResolver \UidValueResolver ;
100
96
use Symfony \Component \HttpKernel \Controller \ArgumentValueResolverInterface ;
101
97
use Symfony \Component \HttpKernel \Controller \ValueResolverInterface ;
102
98
use Symfony \Component \HttpKernel \DataCollector \DataCollectorInterface ;
113
109
use Symfony \Component \Mercure \HubRegistry ;
114
110
use Symfony \Component \Messenger \Attribute \AsMessageHandler ;
115
111
use Symfony \Component \Messenger \Bridge as MessengerBridge ;
116
- use Symfony \Component \Messenger \Command \StatsCommand ;
117
112
use Symfony \Component \Messenger \EventListener \StopWorkerOnSignalsListener ;
118
113
use Symfony \Component \Messenger \Handler \BatchHandlerInterface ;
119
114
use Symfony \Component \Messenger \Handler \MessageHandlerInterface ;
150
145
use Symfony \Component \RemoteEvent \Attribute \AsRemoteEventConsumer ;
151
146
use Symfony \Component \RemoteEvent \RemoteEvent ;
152
147
use Symfony \Component \Routing \Loader \AnnotationClassLoader ;
153
- use Symfony \Component \Routing \Loader \Psr4DirectoryLoader ;
154
148
use Symfony \Component \Scheduler \Attribute \AsSchedule ;
155
149
use Symfony \Component \Scheduler \Messenger \SchedulerTransportFactory ;
156
150
use Symfony \Component \Security \Core \AuthenticationEvents ;
167
161
use Symfony \Component \Serializer \Mapping \Loader \YamlFileLoader ;
168
162
use Symfony \Component \Serializer \Normalizer \DenormalizerInterface ;
169
163
use Symfony \Component \Serializer \Normalizer \NormalizerInterface ;
170
- use Symfony \Component \Serializer \Normalizer \ProblemNormalizer ;
171
- use Symfony \Component \Serializer \Normalizer \UnwrappingDenormalizer ;
172
164
use Symfony \Component \Serializer \Serializer ;
173
- use Symfony \Component \Serializer \SerializerAwareInterface ;
174
165
use Symfony \Component \Stopwatch \Stopwatch ;
175
166
use Symfony \Component \String \LazyString ;
176
167
use Symfony \Component \String \Slugger \SluggerInterface ;
182
173
use Symfony \Component \Translation \Translator ;
183
174
use Symfony \Component \Uid \Factory \UuidFactory ;
184
175
use Symfony \Component \Uid \UuidV4 ;
185
- use Symfony \Component \Validator \Constraints \WhenValidator ;
186
176
use Symfony \Component \Validator \ConstraintValidatorInterface ;
187
177
use Symfony \Component \Validator \Mapping \Loader \PropertyInfoLoader ;
188
178
use Symfony \Component \Validator \ObjectInitializerInterface ;
@@ -227,11 +217,6 @@ public function load(array $configs, ContainerBuilder $container)
227
217
}
228
218
229
219
$ loader ->load ('web.php ' );
230
-
231
- if (!class_exists (BackedEnumValueResolver::class)) {
232
- $ container ->removeDefinition ('argument_resolver.backed_enum_resolver ' );
233
- }
234
-
235
220
$ loader ->load ('services.php ' );
236
221
$ loader ->load ('fragment_renderer.php ' );
237
222
$ loader ->load ('error_renderer.php ' );
@@ -775,11 +760,6 @@ private function registerFormConfiguration(array $config, ContainerBuilder $cont
775
760
if (!ContainerBuilder::willBeAvailable ('symfony/translation ' , Translator::class, ['symfony/framework-bundle ' , 'symfony/form ' ])) {
776
761
$ container ->removeDefinition ('form.type_extension.upload.validator ' );
777
762
}
778
- if (!method_exists (CachingFactoryDecorator::class, 'reset ' )) {
779
- $ container ->getDefinition ('form.choice_list_factory.cached ' )
780
- ->clearTag ('kernel.reset ' )
781
- ;
782
- }
783
763
}
784
764
785
765
private function registerHttpCacheConfiguration (array $ config , ContainerBuilder $ container , bool $ httpMethodOverride ): void
@@ -1219,10 +1199,6 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co
1219
1199
->replaceArgument (0 , $ config ['default_uri ' ]);
1220
1200
}
1221
1201
1222
- if (!class_exists (Psr4DirectoryLoader::class)) {
1223
- $ container ->removeDefinition ('routing.loader.psr4 ' );
1224
- }
1225
-
1226
1202
if ($ this ->isInitializedConfigEnabled ('annotations ' ) && (new \ReflectionClass (AnnotationClassLoader::class))->hasProperty ('reader ' )) {
1227
1203
$ container ->getDefinition ('routing.loader.annotation ' )->setArguments ([
1228
1204
new Reference ('annotation_reader ' ),
@@ -1688,10 +1664,6 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
1688
1664
if (!class_exists (ExpressionLanguage::class)) {
1689
1665
$ container ->removeDefinition ('validator.expression_language ' );
1690
1666
}
1691
-
1692
- if (!class_exists (WhenValidator::class)) {
1693
- $ container ->removeDefinition ('validator.when ' );
1694
- }
1695
1667
}
1696
1668
1697
1669
private function registerValidatorMapping (ContainerBuilder $ container , array $ config , array &$ files ): void
@@ -1911,7 +1883,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
1911
1883
$ container ->removeDefinition ('serializer.encoder.yaml ' );
1912
1884
}
1913
1885
1914
- if (!class_exists (UnwrappingDenormalizer::class) || ! $ this ->isInitializedConfigEnabled ('property_access ' )) {
1886
+ if (!$ this ->isInitializedConfigEnabled ('property_access ' )) {
1915
1887
$ container ->removeDefinition ('serializer.denormalizer.unwrapping ' );
1916
1888
}
1917
1889
@@ -1923,12 +1895,6 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
1923
1895
$ container ->removeDefinition ('serializer.normalizer.translatable ' );
1924
1896
}
1925
1897
1926
- // compat with Symfony < 6.3
1927
- if (!is_subclass_of (ProblemNormalizer::class, SerializerAwareInterface::class)) {
1928
- $ container ->getDefinition ('serializer.normalizer.problem ' )
1929
- ->setArguments (['%kernel.debug% ' ]);
1930
- }
1931
-
1932
1898
$ serializerLoaders = [];
1933
1899
if (isset ($ config ['enable_attributes ' ]) && $ config ['enable_attributes ' ]) {
1934
1900
if ($ container ->getParameter ('kernel.debug ' )) {
@@ -2125,7 +2091,7 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
2125
2091
throw new LogicException ('Messenger support cannot be enabled as the Messenger component is not installed. Try running "composer require symfony/messenger". ' );
2126
2092
}
2127
2093
2128
- if (!$ this ->hasConsole () || ! class_exists (StatsCommand::class) ) {
2094
+ if (!$ this ->hasConsole ()) {
2129
2095
$ container ->removeDefinition ('console.command.messenger_stats ' );
2130
2096
}
2131
2097
@@ -2370,10 +2336,6 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
2370
2336
2371
2337
private function registerCacheConfiguration (array $ config , ContainerBuilder $ container ): void
2372
2338
{
2373
- if (!class_exists (DefaultMarshaller::class)) {
2374
- $ container ->removeDefinition ('cache.default_marshaller ' );
2375
- }
2376
-
2377
2339
$ version = new Parameter ('container.build_id ' );
2378
2340
$ container ->getDefinition ('cache.adapter.apcu ' )->replaceArgument (2 , $ version );
2379
2341
$ container ->getDefinition ('cache.adapter.system ' )->replaceArgument (2 , $ version );
@@ -2434,16 +2396,10 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
2434
2396
$ container ->register ($ name , TagAwareAdapter::class)
2435
2397
->addArgument (new Reference ('. ' .$ name .'.inner ' ))
2436
2398
->addArgument (true !== $ pool ['tags ' ] ? new Reference ($ pool ['tags ' ]) : null )
2399
+ ->addMethodCall ('setLogger ' , [new Reference ('logger ' , ContainerInterface::IGNORE_ON_INVALID_REFERENCE )])
2437
2400
->setPublic ($ pool ['public ' ])
2438
2401
->addTag ('cache.taggable ' , ['pool ' => $ name ])
2439
- ;
2440
-
2441
- if (method_exists (TagAwareAdapter::class, 'setLogger ' )) {
2442
- $ container
2443
- ->getDefinition ($ name )
2444
- ->addMethodCall ('setLogger ' , [new Reference ('logger ' , ContainerInterface::IGNORE_ON_INVALID_REFERENCE )])
2445
- ->addTag ('monolog.logger ' , ['channel ' => 'cache ' ]);
2446
- }
2402
+ ->addTag ('monolog.logger ' , ['channel ' => 'cache ' ]);
2447
2403
2448
2404
$ pool ['name ' ] = $ tagAwareId = $ name ;
2449
2405
$ pool ['public ' ] = false ;
@@ -2469,7 +2425,7 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
2469
2425
$ container ->setDefinition ($ name , $ definition );
2470
2426
}
2471
2427
2472
- if (method_exists (PropertyAccessor::class, ' createCache ' )) {
2428
+ if (class_exists (PropertyAccessor::class)) {
2473
2429
$ propertyAccessDefinition = $ container ->register ('cache.property_access ' , AdapterInterface::class);
2474
2430
2475
2431
if (!$ container ->getParameter ('kernel.debug ' )) {
@@ -2514,20 +2470,16 @@ private function registerHttpClientConfiguration(array $config, ContainerBuilder
2514
2470
$ this ->registerRetryableHttpClient ($ retryOptions , 'http_client ' , $ container );
2515
2471
}
2516
2472
2517
- if ($ hasUriTemplate = class_exists (UriTemplateHttpClient::class)) {
2518
- if (ContainerBuilder::willBeAvailable ('guzzlehttp/uri-template ' , \GuzzleHttp \UriTemplate \UriTemplate::class, [])) {
2519
- $ container ->setAlias ('http_client.uri_template_expander ' , 'http_client.uri_template_expander.guzzle ' );
2520
- } elseif (ContainerBuilder::willBeAvailable ('rize/uri-template ' , \Rize \UriTemplate::class, [])) {
2521
- $ container ->setAlias ('http_client.uri_template_expander ' , 'http_client.uri_template_expander.rize ' );
2522
- }
2523
-
2524
- $ container
2525
- ->getDefinition ('http_client.uri_template ' )
2526
- ->setArgument (2 , $ defaultUriTemplateVars );
2527
- } elseif ($ defaultUriTemplateVars ) {
2528
- throw new LogicException ('Support for URI template requires symfony/http-client 6.3 or higher, try upgrading. ' );
2473
+ if (ContainerBuilder::willBeAvailable ('guzzlehttp/uri-template ' , \GuzzleHttp \UriTemplate \UriTemplate::class, [])) {
2474
+ $ container ->setAlias ('http_client.uri_template_expander ' , 'http_client.uri_template_expander.guzzle ' );
2475
+ } elseif (ContainerBuilder::willBeAvailable ('rize/uri-template ' , \Rize \UriTemplate::class, [])) {
2476
+ $ container ->setAlias ('http_client.uri_template_expander ' , 'http_client.uri_template_expander.rize ' );
2529
2477
}
2530
2478
2479
+ $ container
2480
+ ->getDefinition ('http_client.uri_template ' )
2481
+ ->setArgument (2 , $ defaultUriTemplateVars );
2482
+
2531
2483
foreach ($ config ['scoped_clients ' ] as $ name => $ scopeConfig ) {
2532
2484
if ($ container ->has ($ name )) {
2533
2485
throw new InvalidArgumentException (sprintf ('Invalid scope name: "%s" is reserved. ' , $ name ));
@@ -2558,16 +2510,14 @@ private function registerHttpClientConfiguration(array $config, ContainerBuilder
2558
2510
$ this ->registerRetryableHttpClient ($ retryOptions , $ name , $ container );
2559
2511
}
2560
2512
2561
- if ($ hasUriTemplate ) {
2562
- $ container
2563
- ->register ($ name .'.uri_template ' , UriTemplateHttpClient::class)
2564
- ->setDecoratedService ($ name , null , 7 ) // Between TraceableHttpClient (5) and RetryableHttpClient (10)
2565
- ->setArguments ([
2566
- new Reference ($ name .'.uri_template.inner ' ),
2567
- new Reference ('http_client.uri_template_expander ' , ContainerInterface::NULL_ON_INVALID_REFERENCE ),
2568
- $ defaultUriTemplateVars ,
2569
- ]);
2570
- }
2513
+ $ container
2514
+ ->register ($ name .'.uri_template ' , UriTemplateHttpClient::class)
2515
+ ->setDecoratedService ($ name , null , 7 ) // Between TraceableHttpClient (5) and RetryableHttpClient (10)
2516
+ ->setArguments ([
2517
+ new Reference ($ name .'.uri_template.inner ' ),
2518
+ new Reference ('http_client.uri_template_expander ' , ContainerInterface::NULL_ON_INVALID_REFERENCE ),
2519
+ $ defaultUriTemplateVars ,
2520
+ ]);
2571
2521
2572
2522
$ container ->registerAliasForArgument ($ name , HttpClientInterface::class);
2573
2523
@@ -3021,10 +2971,6 @@ private function registerUidConfiguration(array $config, ContainerBuilder $conta
3021
2971
$ container ->getDefinition ('name_based_uuid.factory ' )
3022
2972
->setArguments ([$ config ['name_based_uuid_namespace ' ]]);
3023
2973
}
3024
-
3025
- if (!class_exists (UidValueResolver::class)) {
3026
- $ container ->removeDefinition ('argument_resolver.uid ' );
3027
- }
3028
2974
}
3029
2975
3030
2976
private function registerHtmlSanitizerConfiguration (array $ config , ContainerBuilder $ container , PhpFileLoader $ loader ): void
0 commit comments