5353use Symfony \Component \DependencyInjection \Exception \InvalidArgumentException ;
5454use Symfony \Component \DependencyInjection \Exception \LogicException ;
5555use Symfony \Component \DependencyInjection \Loader \PhpFileLoader ;
56- use Symfony \Component \DependencyInjection \Loader \XmlFileLoader ;
5756use Symfony \Component \DependencyInjection \Parameter ;
5857use Symfony \Component \DependencyInjection \Reference ;
5958use Symfony \Component \DependencyInjection \ServiceLocator ;
@@ -171,14 +170,12 @@ class FrameworkExtension extends Extension
171170 */
172171 public function load (array $ configs , ContainerBuilder $ container )
173172 {
174- $ loader = new XmlFileLoader ($ container , new FileLocator (\dirname (__DIR__ ).'/Resources/config ' ));
173+ $ loader = new PhpFileLoader ($ container , new FileLocator (\dirname (__DIR__ ).'/Resources/config ' ));
175174
176- $ phpLoader = new PhpFileLoader ($ container , new FileLocator (\dirname (__DIR__ ).'/Resources/config ' ));
177-
178- $ phpLoader ->load ('web.php ' );
179- $ phpLoader ->load ('services.php ' );
180- $ phpLoader ->load ('fragment_renderer.php ' );
181- $ phpLoader ->load ('error_renderer.php ' );
175+ $ loader ->load ('web.php ' );
176+ $ loader ->load ('services.php ' );
177+ $ loader ->load ('fragment_renderer.php ' );
178+ $ loader ->load ('error_renderer.php ' );
182179
183180 if (interface_exists (PsrEventDispatcherInterface::class)) {
184181 $ container ->setAlias (PsrEventDispatcherInterface::class, 'event_dispatcher ' );
@@ -187,7 +184,7 @@ public function load(array $configs, ContainerBuilder $container)
187184 $ container ->registerAliasForArgument ('parameter_bag ' , PsrContainerInterface::class);
188185
189186 if (class_exists (Application::class)) {
190- $ phpLoader ->load ('console.php ' );
187+ $ loader ->load ('console.php ' );
191188
192189 if (!class_exists (BaseXliffLintCommand::class)) {
193190 $ container ->removeDefinition ('console.command.xliff_lint ' );
@@ -198,7 +195,7 @@ public function load(array $configs, ContainerBuilder $container)
198195 }
199196
200197 // Load Cache configuration first as it is used by other components
201- $ phpLoader ->load ('cache.php ' );
198+ $ loader ->load ('cache.php ' );
202199
203200 $ configuration = $ this ->getConfiguration ($ configs , $ container );
204201 $ config = $ this ->processConfiguration ($ configuration , $ configs );
@@ -215,7 +212,7 @@ public function load(array $configs, ContainerBuilder $container)
215212 }
216213
217214 if (class_exists (Translator::class)) {
218- $ phpLoader ->load ('identity_translator.php ' );
215+ $ loader ->load ('identity_translator.php ' );
219216 }
220217 }
221218
@@ -266,7 +263,7 @@ public function load(array $configs, ContainerBuilder $container)
266263 }
267264
268265 if (!empty ($ config ['test ' ])) {
269- $ phpLoader ->load ('test.php ' );
266+ $ loader ->load ('test.php ' );
270267
271268 if (!class_exists (AbstractBrowser::class)) {
272269 $ container ->removeDefinition ('test.client ' );
@@ -282,28 +279,28 @@ public function load(array $configs, ContainerBuilder $container)
282279 }
283280
284281 $ this ->sessionConfigEnabled = true ;
285- $ this ->registerSessionConfiguration ($ config ['session ' ], $ container , $ phpLoader );
282+ $ this ->registerSessionConfiguration ($ config ['session ' ], $ container , $ loader );
286283 if (!empty ($ config ['test ' ])) {
287284 $ container ->getDefinition ('test.session.listener ' )->setArgument (1 , '%session.storage.options% ' );
288285 }
289286 }
290287
291288 if ($ this ->isConfigEnabled ($ container , $ config ['request ' ])) {
292- $ this ->registerRequestConfiguration ($ config ['request ' ], $ container , $ phpLoader );
289+ $ this ->registerRequestConfiguration ($ config ['request ' ], $ container , $ loader );
293290 }
294291
295292 if (null === $ config ['csrf_protection ' ]['enabled ' ]) {
296293 $ config ['csrf_protection ' ]['enabled ' ] = $ this ->sessionConfigEnabled && !class_exists (FullStack::class) && interface_exists (CsrfTokenManagerInterface::class);
297294 }
298- $ this ->registerSecurityCsrfConfiguration ($ config ['csrf_protection ' ], $ container , $ phpLoader );
295+ $ this ->registerSecurityCsrfConfiguration ($ config ['csrf_protection ' ], $ container , $ loader );
299296
300297 if ($ this ->isConfigEnabled ($ container , $ config ['form ' ])) {
301298 if (!class_exists ('Symfony\Component\Form\Form ' )) {
302299 throw new LogicException ('Form support cannot be enabled as the Form component is not installed. Try running "composer require symfony/form". ' );
303300 }
304301
305302 $ this ->formConfigEnabled = true ;
306- $ this ->registerFormConfiguration ($ config , $ container , $ phpLoader );
303+ $ this ->registerFormConfiguration ($ config , $ container , $ loader );
307304
308305 if (class_exists ('Symfony\Component\Validator\Validation ' )) {
309306 $ config ['validation ' ]['enabled ' ] = true ;
@@ -322,11 +319,11 @@ public function load(array $configs, ContainerBuilder $container)
322319 throw new LogicException ('Asset support cannot be enabled as the Asset component is not installed. Try running "composer require symfony/asset". ' );
323320 }
324321
325- $ this ->registerAssetsConfiguration ($ config ['assets ' ], $ container , $ phpLoader );
322+ $ this ->registerAssetsConfiguration ($ config ['assets ' ], $ container , $ loader );
326323 }
327324
328325 if ($ this ->messengerConfigEnabled = $ this ->isConfigEnabled ($ container , $ config ['messenger ' ])) {
329- $ this ->registerMessengerConfiguration ($ config ['messenger ' ], $ container , $ phpLoader , $ config ['validation ' ]);
326+ $ this ->registerMessengerConfiguration ($ config ['messenger ' ], $ container , $ loader , $ config ['validation ' ]);
330327 } else {
331328 $ container ->removeDefinition ('console.command.messenger_consume_messages ' );
332329 $ container ->removeDefinition ('console.command.messenger_debug ' );
@@ -359,54 +356,54 @@ public function load(array $configs, ContainerBuilder $container)
359356 }
360357
361358 if ($ this ->httpClientConfigEnabled = $ this ->isConfigEnabled ($ container , $ config ['http_client ' ])) {
362- $ this ->registerHttpClientConfiguration ($ config ['http_client ' ], $ container , $ phpLoader , $ config ['profiler ' ]);
359+ $ this ->registerHttpClientConfiguration ($ config ['http_client ' ], $ container , $ loader , $ config ['profiler ' ]);
363360 }
364361
365362 if ($ this ->mailerConfigEnabled = $ this ->isConfigEnabled ($ container , $ config ['mailer ' ])) {
366- $ this ->registerMailerConfiguration ($ config ['mailer ' ], $ container , $ phpLoader );
363+ $ this ->registerMailerConfiguration ($ config ['mailer ' ], $ container , $ loader );
367364 }
368365
369366 if ($ this ->isConfigEnabled ($ container , $ config ['notifier ' ])) {
370- $ this ->registerNotifierConfiguration ($ config ['notifier ' ], $ container , $ phpLoader );
367+ $ this ->registerNotifierConfiguration ($ config ['notifier ' ], $ container , $ loader );
371368 }
372369
373370 $ propertyInfoEnabled = $ this ->isConfigEnabled ($ container , $ config ['property_info ' ]);
374- $ this ->registerValidationConfiguration ($ config ['validation ' ], $ container , $ phpLoader , $ propertyInfoEnabled );
371+ $ this ->registerValidationConfiguration ($ config ['validation ' ], $ container , $ loader , $ propertyInfoEnabled );
375372 $ this ->registerHttpCacheConfiguration ($ config ['http_cache ' ], $ container );
376- $ this ->registerEsiConfiguration ($ config ['esi ' ], $ container , $ phpLoader );
377- $ this ->registerSsiConfiguration ($ config ['ssi ' ], $ container , $ phpLoader );
378- $ this ->registerFragmentsConfiguration ($ config ['fragments ' ], $ container , $ phpLoader );
379- $ this ->registerTranslatorConfiguration ($ config ['translator ' ], $ container , $ phpLoader , $ config ['default_locale ' ]);
380- $ this ->registerProfilerConfiguration ($ config ['profiler ' ], $ container , $ loader, $ phpLoader );
381- $ this ->registerWorkflowConfiguration ($ config ['workflows ' ], $ container , $ phpLoader );
382- $ this ->registerDebugConfiguration ($ config ['php_errors ' ], $ container , $ phpLoader );
383- $ this ->registerRouterConfiguration ($ config ['router ' ], $ container , $ phpLoader , $ config ['translator ' ]['enabled_locales ' ] ?? []);
384- $ this ->registerAnnotationsConfiguration ($ config ['annotations ' ], $ container , $ phpLoader );
385- $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container , $ phpLoader );
386- $ this ->registerSecretsConfiguration ($ config ['secrets ' ], $ container , $ phpLoader );
373+ $ this ->registerEsiConfiguration ($ config ['esi ' ], $ container , $ loader );
374+ $ this ->registerSsiConfiguration ($ config ['ssi ' ], $ container , $ loader );
375+ $ this ->registerFragmentsConfiguration ($ config ['fragments ' ], $ container , $ loader );
376+ $ this ->registerTranslatorConfiguration ($ config ['translator ' ], $ container , $ loader , $ config ['default_locale ' ]);
377+ $ this ->registerProfilerConfiguration ($ config ['profiler ' ], $ container , $ loader );
378+ $ this ->registerWorkflowConfiguration ($ config ['workflows ' ], $ container , $ loader );
379+ $ this ->registerDebugConfiguration ($ config ['php_errors ' ], $ container , $ loader );
380+ $ this ->registerRouterConfiguration ($ config ['router ' ], $ container , $ loader , $ config ['translator ' ]['enabled_locales ' ] ?? []);
381+ $ this ->registerAnnotationsConfiguration ($ config ['annotations ' ], $ container , $ loader );
382+ $ this ->registerPropertyAccessConfiguration ($ config ['property_access ' ], $ container , $ loader );
383+ $ this ->registerSecretsConfiguration ($ config ['secrets ' ], $ container , $ loader );
387384
388385 if ($ this ->isConfigEnabled ($ container , $ config ['serializer ' ])) {
389386 if (!class_exists ('Symfony\Component\Serializer\Serializer ' )) {
390387 throw new LogicException ('Serializer support cannot be enabled as the Serializer component is not installed. Try running "composer require symfony/serializer-pack". ' );
391388 }
392389
393- $ this ->registerSerializerConfiguration ($ config ['serializer ' ], $ container , $ phpLoader );
390+ $ this ->registerSerializerConfiguration ($ config ['serializer ' ], $ container , $ loader );
394391 }
395392
396393 if ($ propertyInfoEnabled ) {
397- $ this ->registerPropertyInfoConfiguration ($ container , $ phpLoader );
394+ $ this ->registerPropertyInfoConfiguration ($ container , $ loader );
398395 }
399396
400397 if ($ this ->isConfigEnabled ($ container , $ config ['lock ' ])) {
401- $ this ->registerLockConfiguration ($ config ['lock ' ], $ container , $ phpLoader );
398+ $ this ->registerLockConfiguration ($ config ['lock ' ], $ container , $ loader );
402399 }
403400
404401 if ($ this ->isConfigEnabled ($ container , $ config ['web_link ' ])) {
405402 if (!class_exists (HttpHeaderSerializer::class)) {
406403 throw new LogicException ('WebLink support cannot be enabled as the WebLink component is not installed. Try running "composer require symfony/weblink". ' );
407404 }
408405
409- $ phpLoader ->load ('web_link.php ' );
406+ $ loader ->load ('web_link.php ' );
410407 }
411408
412409 $ this ->addAnnotatedClassesToCompile ([
@@ -418,7 +415,7 @@ public function load(array $configs, ContainerBuilder $container)
418415 ]);
419416
420417 if (class_exists (MimeTypes::class)) {
421- $ phpLoader ->load ('mime_type.php ' );
418+ $ loader ->load ('mime_type.php ' );
422419 }
423420
424421 $ container ->registerForAutoconfiguration (Command::class)
@@ -590,7 +587,7 @@ private function registerFragmentsConfiguration(array $config, ContainerBuilder
590587 $ container ->setParameter ('fragment.path ' , $ config ['path ' ]);
591588 }
592589
593- private function registerProfilerConfiguration (array $ config , ContainerBuilder $ container , XmlFileLoader $ loader , PhpFileLoader $ phpLoader )
590+ private function registerProfilerConfiguration (array $ config , ContainerBuilder $ container , PhpFileLoader $ loader )
594591 {
595592 if (!$ this ->isConfigEnabled ($ container , $ config )) {
596593 // this is needed for the WebProfiler to work even if the profiler is disabled
@@ -599,34 +596,34 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
599596 return ;
600597 }
601598
602- $ phpLoader ->load ('profiling.php ' );
603- $ phpLoader ->load ('collectors.php ' );
604- $ phpLoader ->load ('cache_debug.php ' );
599+ $ loader ->load ('profiling.php ' );
600+ $ loader ->load ('collectors.php ' );
601+ $ loader ->load ('cache_debug.php ' );
605602
606603 if ($ this ->formConfigEnabled ) {
607- $ phpLoader ->load ('form_debug.php ' );
604+ $ loader ->load ('form_debug.php ' );
608605 }
609606
610607 if ($ this ->validatorConfigEnabled ) {
611- $ phpLoader ->load ('validator_debug.php ' );
608+ $ loader ->load ('validator_debug.php ' );
612609 }
613610
614611 if ($ this ->translationConfigEnabled ) {
615- $ phpLoader ->load ('translation_debug.php ' );
612+ $ loader ->load ('translation_debug.php ' );
616613
617614 $ container ->getDefinition ('translator.data_collector ' )->setDecoratedService ('translator ' );
618615 }
619616
620617 if ($ this ->messengerConfigEnabled ) {
621- $ phpLoader ->load ('messenger_debug.php ' );
618+ $ loader ->load ('messenger_debug.php ' );
622619 }
623620
624621 if ($ this ->mailerConfigEnabled ) {
625- $ phpLoader ->load ('mailer_debug.php ' );
622+ $ loader ->load ('mailer_debug.php ' );
626623 }
627624
628625 if ($ this ->httpClientConfigEnabled ) {
629- $ phpLoader ->load ('http_client_debug.php ' );
626+ $ loader ->load ('http_client_debug.php ' );
630627 }
631628
632629 $ container ->setParameter ('profiler_listener.only_exceptions ' , $ config ['only_exceptions ' ]);
@@ -1458,7 +1455,7 @@ private function registerSecretsConfiguration(array $config, ContainerBuilder $c
14581455 }
14591456 }
14601457
1461- private function registerSecurityCsrfConfiguration (array $ config , ContainerBuilder $ container , PhpFileLoader $ phpLoader )
1458+ private function registerSecurityCsrfConfiguration (array $ config , ContainerBuilder $ container , PhpFileLoader $ loader )
14621459 {
14631460 if (!$ this ->isConfigEnabled ($ container , $ config )) {
14641461 return ;
@@ -1473,7 +1470,7 @@ private function registerSecurityCsrfConfiguration(array $config, ContainerBuild
14731470 }
14741471
14751472 // Enable services for CSRF protection (even without forms)
1476- $ phpLoader ->load ('security_csrf.php ' );
1473+ $ loader ->load ('security_csrf.php ' );
14771474
14781475 if (!class_exists (CsrfExtension::class)) {
14791476 $ container ->removeDefinition ('twig.extension.security_csrf ' );
0 commit comments