From ca72bbbf4d8c319fbff53d6693e6825307a01a49 Mon Sep 17 00:00:00 2001 From: dangkhoagms Date: Mon, 15 Jun 2020 20:31:27 +0700 Subject: [PATCH] [request] Move configuration to PHP --- .../FrameworkExtension.php | 6 ++--- .../Resources/config/request.php | 22 +++++++++++++++++++ .../Resources/config/request.xml | 15 ------------- 3 files changed, 25 insertions(+), 18 deletions(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Resources/config/request.php delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Resources/config/request.xml diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 775075fca3ba0..0c914b80f2365 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -282,7 +282,7 @@ public function load(array $configs, ContainerBuilder $container) } if ($this->isConfigEnabled($container, $config['request'])) { - $this->registerRequestConfiguration($config['request'], $container, $loader); + $this->registerRequestConfiguration($config['request'], $container, $phpLoader); } if (null === $config['csrf_protection']['enabled']) { @@ -980,10 +980,10 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c $container->setParameter('session.metadata.update_threshold', $config['metadata_update_threshold']); } - private function registerRequestConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader) + private function registerRequestConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader) { if ($config['formats']) { - $loader->load('request.xml'); + $loader->load('request.php'); $listener = $container->getDefinition('request.add_request_formats_listener'); $listener->replaceArgument(0, $config['formats']); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/request.php b/src/Symfony/Bundle/FrameworkBundle/Resources/config/request.php new file mode 100644 index 0000000000000..ef8fc9a5e7d8c --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/request.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Loader\Configurator; + +use Symfony\Component\HttpKernel\EventListener\AddRequestFormatsListener; + +return static function (ContainerConfigurator $container) { + $container->services() + ->set('request.add_request_formats_listener', AddRequestFormatsListener::class) + ->args([abstract_arg('formats')]) + ->tag('kernel.event_subscriber') + ; +}; diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/request.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/request.xml deleted file mode 100644 index 048b61ec466f0..0000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/request.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - -