8000 minor #37287 [request] Move configuration to PHP (dangkhoagms) · symfony/symfony@7838fef · GitHub
[go: up one dir, main page]

Skip to content

Commit 7838fef

Browse files
committed
minor #37287 [request] Move configuration to PHP (dangkhoagms)
This PR was squashed before being merged into the 5.2-dev branch. Discussion ---------- [request] Move configuration to PHP | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Part of #37186 | License | MIT | Doc PR | <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Never break backward compatibility (see https://symfony.com/bc). - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too.) - Features and deprecations must be submitted against branch master. --> Commits ------- ca72bbb [request] Move configuration to PHP
2 parents 8a6a95a + ca72bbb commit 7838fef

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public function load(array $configs, ContainerBuilder $container)
282282
}
283283

284284
if ($this->isConfigEnabled($container, $config['request'])) {
285-
$this->registerRequestConfiguration($config['request'], $container, $loader);
285+
$this->registerRequestConfiguration($config['request'], $container, $phpLoader);
286286
}
287287

288288
if (null === $config['csrf_protection']['enabled']) {
@@ -980,10 +980,10 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
980980
$container->setParameter('session.metadata.update_threshold', $config['metadata_update_threshold']);
981981
}
982982

983-
private function registerRequestConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
983+
private function registerRequestConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader)
984984
{
985985
if ($config['formats']) {
986-
$loader->load('request.xml');
986+
$loader->load('request.php');
987987

988988
$listener = $container->getDefinition('request.add_request_formats_listener');
989989
$listener->replaceArgument(0, $config['formats']);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
13+
14+
use Symfony\Component\HttpKernel\EventListener\AddRequestFormatsListener;
15+
16+
return static function (ContainerConfigurator $container) {
17+
$container->services()
18+
->set('request.add_request_formats_listener', AddRequestFormatsListener::class)
19+
->args([abstract_arg('formats')])
20+
->tag('kernel.event_subscriber')
21+
;
22+
};

src/Symfony/Bundle/FrameworkBundle/Resources/config/request.xml

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0