40
40
use Symfony \Component \Cache \Adapter \ChainAdapter ;
41
41
use Symfony \Component \Cache \Adapter \TagAwareAdapter ;
42
42
use Symfony \Component \Cache \DependencyInjection \CachePoolPass ;
43
- use Symfony \Component \Cache \Marshaller \DefaultMarshaller ;
44
43
use Symfony \Component \Cache \Marshaller \MarshallerInterface ;
45
44
use Symfony \Component \Cache \ResettableInterface ;
46
45
use Symfony \Component \Clock \ClockInterface ;
73
72
use Symfony \Component \ExpressionLanguage \ExpressionLanguage ;
74
73
use Symfony \Component \Finder \Finder ;
75
74
use Symfony \Component \Finder \Glob ;
76
- use Symfony \Component \Form \ChoiceList \Factory \CachingFactoryDecorator ;
77
75
use Symfony \Component \Form \Extension \HtmlSanitizer \Type \TextTypeHtmlSanitizerExtension ;
78
76
use Symfony \Component \Form \Form ;
79
77
use Symfony \Component \Form \FormTypeExtensionInterface ;
93
91
use Symfony \Component \HttpKernel \Attribute \AsTargetedValueResolver ;
94
92
use Symfony \Component \HttpKernel \CacheClearer \CacheClearerInterface ;
95
93
use Symfony \Component \HttpKernel \CacheWarmer \CacheWarmerInterface ;
96
- use Symfony \Component \HttpKernel \Controller \ArgumentResolver \BackedEnumValueResolver ;
97
- use Symfony \Component \HttpKernel \Controller \ArgumentResolver \UidValueResolver ;
98
94
use Symfony \Component \HttpKernel \Controller \ValueResolverInterface ;
99
95
use Symfony \Component \HttpKernel \DataCollector \DataCollectorInterface ;
100
96
use Symfony \Component \HttpKernel \DependencyInjection \Extension ;
110
106
use Symfony \Component \Mercure \HubRegistry ;
111
107
use Symfony \Component \Messenger \Attribute \AsMessageHandler ;
112
108
use Symfony \Component \Messenger \Bridge as MessengerBridge ;
113
- use Symfony \Component \Messenger \Command \StatsCommand ;
114
109
use Symfony \Component \Messenger \Handler \BatchHandlerInterface ;
115
110
use Symfony \Component \Messenger \MessageBus ;
116
111
use Symfony \Component \Messenger \MessageBusInterface ;
144
139
use Symfony \Component \RateLimiter \Storage \CacheStorage ;
145
140
use Symfony \Component \RemoteEvent \Attribute \AsRemoteEventConsumer ;
146
141
use Symfony \Component \RemoteEvent \RemoteEvent ;
147
- use Symfony \Component \Routing \Loader \Psr4DirectoryLoader ;
148
142
use Symfony \Component \Scheduler \Attribute \AsSchedule ;
149
143
use Symfony \Component \Scheduler \Messenger \SchedulerTransportFactory ;
150
144
use Symfony \Component \Security \Core \AuthenticationEvents ;
161
155
use Symfony \Component \Serializer \Mapping \Loader \YamlFileLoader ;
162
156
use Symfony \Component \Serializer \Normalizer \DenormalizerInterface ;
163
157
use Symfony \Component \Serializer \Normalizer \NormalizerInterface ;
164
- use Symfony \Component \Serializer \Normalizer \UnwrappingDenormalizer ;
165
158
use Symfony \Component \Serializer \Serializer ;
166
159
use Symfony \Component \Stopwatch \Stopwatch ;
167
160
use Symfony \Component \String \LazyString ;
174
167
use Symfony \Component \Translation \Translator ;
175
168
use Symfony \Component \Uid \Factory \UuidFactory ;
176
169
use Symfony \Component \Uid \UuidV4 ;
177
- use Symfony \Component \Validator \Constraints \WhenValidator ;
178
170
use Symfony \Component \Validator \ConstraintValidatorInterface ;
179
171
use Symfony \Component \Validator \Mapping \Loader \PropertyInfoLoader ;
180
172
use Symfony \Component \Validator \ObjectInitializerInterface ;
@@ -216,11 +208,6 @@ public function load(array $configs, ContainerBuilder $container): void
216
208
}
217
209
218
210
$ loader ->load ('web.php ' );
219
-
220
- if (!class_exists (BackedEnumValueResolver::class)) {
221
- $ container ->removeDefinition ('argument_resolver.backed_enum_resolver ' );
222
- }
223
-
224
211
$ loader ->load ('services.php ' );
225
212
$ loader ->load ('fragment_renderer.php ' );
226
213
$ loader ->load ('error_renderer.php ' );
@@ -757,11 +744,6 @@ private function registerFormConfiguration(array $config, ContainerBuilder $cont
757
744
if (!ContainerBuilder::willBeAvailable ('symfony/translation ' , Translator::class, ['symfony/framework-bundle ' , 'symfony/form ' ])) {
758
745
$ container ->removeDefinition ('form.type_extension.upload.validator ' );
759
746
}
760
- if (!method_exists (CachingFactoryDecorator::class, 'reset ' )) {
761
- $ container ->getDefinition ('form.choice_list_factory.cached ' )
762
- ->clearTag ('kernel.reset ' )
763
- ;
764
- }
765
747
}
766
748
767
749
private function registerHttpCacheConfiguration (array $ config , ContainerBuilder $ container , bool $ httpMethodOverride ): void
@@ -1200,10 +1182,6 @@ private function registerRouterConfiguration(array $config, ContainerBuilder $co
1200
1182
$ container ->getDefinition ('router.request_context ' )
1201
1183
->replaceArgument (0 , $ config ['default_uri ' ]);
1202
1184
}
1203
-
1204
- if (!class_exists (Psr4DirectoryLoader::class)) {
1205
- $ container ->removeDefinition ('routing.loader.psr4 ' );
1206
- }
1207
1185
}
1208
1186
1209
1187
private function registerSessionConfiguration (array $ config , ContainerBuilder $ container , PhpFileLoader $ loader ): void
@@ -1557,7 +1535,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
1557
1535
TranslationBridge \Crowdin \CrowdinProviderFactory::class => 'translation.provider_factory.crowdin ' ,
1558
1536
TranslationBridge \Loco \LocoProviderFactory::class => 'translation.provider_factory.loco ' ,
1559
1537
TranslationBridge \Lokalise \LokaliseProviderFactory::class => 'translation.provider_factory.lokalise ' ,
1560
- PhraseProviderFactory::class => 'translation.provider_factory.phrase ' ,
1538
+ TranslationBridge \ Phrase \ PhraseProviderFactory::class => 'translation.provider_factory.phrase ' ,
1561
1539
];
1562
1540
1563
1541
$ parentPackages = ['symfony/framework-bundle ' , 'symfony/translation ' , 'symfony/http-client ' ];
@@ -1665,10 +1643,6 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
1665
1643
if (!class_exists (ExpressionLanguage::class)) {
1666
1644
$ container ->removeDefinition ('validator.expression_language ' );
1667
1645
}
1668
-
1669
- if (!class_exists (WhenValidator::class)) {
1670
- $ container ->removeDefinition ('validator.when ' );
1671
- }
1672
1646
}
1673
1647
1674
1648
private function registerValidatorMapping (ContainerBuilder $ container , array $ config , array &$ files ): void
@@ -1836,7 +1810,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
1836
1810
$ container ->removeDefinition ('serializer.encoder.yaml ' );
1837
1811
}
1838
1812
1839
- if (!class_exists (UnwrappingDenormalizer::class) || ! $ this ->isInitializedConfigEnabled ('property_access ' )) {
1813
+ if (!$ this ->isInitializedConfigEnabled ('property_access ' )) {
1840
1814
$ container ->removeDefinition ('serializer.denormalizer.unwrapping ' );
1841
1815
}
1842
1816
@@ -2041,7 +2015,7 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
2041
2015
throw new LogicException ('Messenger support cannot be enabled as the Messenger component is not installed. Try running "composer require symfony/messenger". ' );
2042
2016
}
2043
2017
2044
- if (!$ this ->hasConsole () || ! class_exists (StatsCommand::class) ) {
2018
+ if (!$ this ->hasConsole ()) {
2045
2019
$ container ->removeDefinition ('console.command.messenger_stats ' );
2046
2020
}
2047
2021
@@ -2280,10 +2254,6 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
2280
2254
2281
2255
private function registerCacheConfiguration (array $ config , ContainerBuilder $ container ): void
2282
2256
{
2283
- if (!class_exists (DefaultMarshaller::class)) {
2284
- $ container ->removeDefinition ('cache.default_marshaller ' );
2285
- }
2286
-
2287
2257
$ version = new Parameter ('container.build_id ' );
2288
2258
$ container ->getDefinition ('cache.adapter.apcu ' )->replaceArgument (2 , $ version );
2289
2259
$ container ->getDefinition ('cache.adapter.system ' )->replaceArgument (2 , $ version );
@@ -2344,16 +2314,10 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
2344
2314
$ container ->register ($ name , TagAwareAdapter::class)
2345
2315
->addArgument (new Reference ('. ' .$ name .'.inner ' ))
2346
2316
->addArgument (true !== $ pool ['tags ' ] ? new Reference ($ pool ['tags ' ]) : null )
2317
+ ->addMethodCall ('setLogger ' , [new Reference ('logger ' , ContainerInterface::IGNORE_ON_INVALID_REFERENCE )])
2347
2318
->setPublic ($ pool ['public ' ])
2348
2319
->addTag ('cache.taggable ' , ['pool ' => $ name ])
2349
- ;
2350
-
2351
- if (method_exists (TagAwareAdapter::class, 'setLogger ' )) {
2352
- $ container
2353
- ->getDefinition ($ name )
2354
- ->addMethodCall ('setLogger ' , [new Reference ('logger ' , ContainerInterface::IGNORE_ON_INVALID_REFERENCE )])
2355
- ->addTag ('monolog.logger ' , ['channel ' => 'cache ' ]);
2356
- }
2320
+ ->addTag ('monolog.logger ' , ['channel ' => 'cache ' ]);
2357
2321
2358
2322
$ pool ['name ' ] = $ tagAwareId = $ name ;
2359
2323
$ pool ['public ' ] = false ;
@@ -2379,7 +2343,7 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
2379
2343
$ container ->setDefinition ($ name , $ definition );
2380
2344
}
2381
2345
2382
- if (method_exists (PropertyAccessor::class, ' createCache ' )) {
2346
+ if (class_exists (PropertyAccessor::class)) {
2383
2347
$ propertyAccessDefinition = $ container ->register ('cache.property_access ' , AdapterInterface::class);
2384
2348
2385
2349
if (!$ container ->getParameter ('kernel.debug ' )) {
@@ -2424,20 +2388,16 @@ private function registerHttpClientConfiguration(array $config, ContainerBuilder
2424
2388
$ this ->registerRetryableHttpClient ($ retryOptions , 'http_client ' , $ container );
2425
2389
}
2426
2390
2427
- if ($ hasUriTemplate = class_exists (UriTemplateHttpClient::class)) {
2428
- if (ContainerBuilder::willBeAvailable ('guzzlehttp/uri-template ' , \GuzzleHttp \UriTemplate \UriTemplate::class, [])) {
2429
- $ container ->setAlias ('http_client.uri_template_expander ' , 'http_client.uri_template_expander.guzzle ' );
2430
- } elseif (ContainerBuilder::willBeAvailable ('rize/uri-template ' , \Rize \UriTemplate::class, [])) {
2431
- $ container ->setAlias ('http_client.uri_template_expander ' , 'http_client.uri_template_expander.rize ' );
2432
- }
2433
-
2434
- $ container
2435
- ->getDefinition ('http_client.uri_template ' )
2436
- ->setArgument (2 , $ defaultUriTemplateVars );
2437
- } elseif ($ defaultUriTemplateVars ) {
2438
- throw new LogicException ('Support for URI template requires symfony/http-client 6.3 or higher, try upgrading. ' );
2391
+ if (ContainerBuilder::willBeAvailable ('guzzlehttp/uri-template ' , \GuzzleHttp \UriTemplate \UriTemplate::class, [])) {
2392
+ $ container ->setAlias ('http_client.uri_template_expander ' , 'http_client.uri_template_expander.guzzle ' );
2393
+ } elseif (ContainerBuilder::willBeAvailable ('rize/uri-template ' , \Rize \UriTemplate::class, [])) {
2394
+ $ container ->setAlias ('http_client.uri_template_expander ' , 'http_client.uri_template_expander.rize ' );
2439
2395
}
2440
2396
2397
+ $ container
2398
+ ->getDefinition ('http_client.uri_template ' )
2399
+ ->setArgument (2 , $ defaultUriTemplateVars );
2400
+
2441
2401
foreach ($ config ['scoped_clients ' ] as $ name => $ scopeConfig ) {
2442
2402
if ($ container ->has ($ name )) {
2443
2403
throw new InvalidArgumentException (sprintf ('Invalid scope name: "%s" is reserved. ' , $ name ));
@@ -2468,16 +2428,14 @@ private function registerHttpClientConfiguration(array $config, ContainerBuilder
2468
2428
$ this ->registerRetryableHttpClient ($ retryOptions , $ name , $ container );
2469
2429
}
2470
2430
2471
- if ($ hasUriTemplate ) {
2472
- $ container
2473
- ->register ($ name .'.uri_template ' , UriTemplateHttpClient::class)
2474
- ->setDecoratedService ($ name , null , 7 ) // Between TraceableHttpClient (5) and RetryableHttpClient (10)
2475
- ->setArguments ([
2476
- new Reference ($ name .'.uri_template.inner ' ),
2477
- new Reference ('http_client.uri_template_expander ' , ContainerInterface::NULL_ON_INVALID_REFERENCE ),
2478
- $ defaultUriTemplateVars ,
2479
- ]);
2480
- }
2431
+ $ container
2432
+ ->register ($ name .'.uri_template ' , UriTemplateHttpClient::class)
2433
+ ->setDecoratedService ($ name , null , 7 ) // Between TraceableHttpClient (5) and RetryableHttpClient (10)
2434
+ ->setArguments ([
2435
+ new Reference ($ name .'.uri_template.inner ' ),
2436
+ new Reference ('http_client.uri_template_expander ' , ContainerInterface::NULL_ON_INVALID_REFERENCE ),
2437
+ $ defaultUriTemplateVars ,
2438
+ ]);
2481
2439
2482
2440
$ container ->registerAliasForArgument ($ name , HttpClientInterface::class);
2483
2441
@@ -2889,10 +2847,6 @@ private function registerUidConfiguration(array $config, ContainerBuilder $conta
2889
2847
$ container ->getDefinition ('name_based_uuid.factory ' )
2890
2848
->setArguments ([$ config ['name_based_uuid_namespace ' ]]);
2891
2849
}
2892
-
2893
- if (!class_exists (UidValueResolver::class)) {
2894
- $ container ->removeDefinition ('argument_resolver.uid ' );
2895
- }
2896
2850
}
2897
2851
2898
2852
private function registerHtmlSanitizerConfiguration (array $ config , ContainerBuilder $ container , PhpFileLoader $ loader ): void
0 commit comments