8000 minor #37212 [FrameworkBundle] Move debug configuration to PHP (Benoi… · symfony/symfony@188a985 · GitHub
[go: up one dir, main page]

Skip to content

Commit 188a985

Browse files
committed
minor #37212 [FrameworkBundle] Move debug configuration to PHP (Benoit Mallo)
This PR was squashed before being merged into the 5.2-dev branch. Discussion ---------- [FrameworkBundle] Move debug configuration to PHP | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Ref #37186 | License | MIT <!-- 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 ------- a226a52 [FrameworkBundle] Move debug configuration to PHP
2 parents eb4d777 + a226a52 commit 188a985

File tree

5 files changed

+94
-70
lines changed

5 files changed

+94
-70
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public function load(array $configs, ContainerBuilder $container)
371371
$this->registerTranslatorConfiguration($config['translator'], $container, $loader, $config['default_locale']);
372372
$this->registerProfilerConfiguration($config['profiler'], $container, $loader);
373373
$this->registerWorkflowConfiguration($config['workflows'], $container, $loader);
374-
$this->registerDebugConfiguration($config['php_errors'], $container, $loader);
374+
$this->registerDebugConfiguration($config['php_errors'], $container, $phpLoader);
375375
$this->registerRouterConfiguration($config['router'], $container, $loader, $config['translator']['enabled_locales'] ?? []);
376376
$this->registerAnnotationsConfiguration($config['annotations'], $container, $loader);
377377
$this->registerPropertyAccessConfiguration($config['property_access'], $container, $loader);
@@ -821,9 +821,9 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
821821
}
822822
}
823823

824-
private function registerDebugConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
824+
private function registerDebugConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader)
825825
{
826-
$loader->load('debug_prod.xml');
826+
$loader->load('debug_prod.php');
827827

828828
if (class_exists(Stopwatch::class)) {
829829
$container->register('debug.stopwatch', Stopwatch::class)
@@ -840,7 +840,7 @@ private function registerDebugConfiguration(array $config, ContainerBuilder $con
840840
}
841841

842842
if ($debug && class_exists(Stopwatch::class)) {
843-
$loader->load('debug.xml');
843+
$loader->load('debug.php');
844844
}
845845

846846
$definition = $container->findDefinition('debug.debug_handlers_listener');
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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\Depend 8000 encyInjection\Loader\Configurator;
13+
14+
use Symfony\Component\HttpKernel\Controller\ArgumentResolver\NotTaggedControllerValueResolver;
15+
use Symfony\Component\HttpKernel\Controller\TraceableArgumentResolver;
16+
use Symfony\Component\HttpKernel\Controller\TraceableControllerResolver;
17+
use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher;
18+
19+
return static function (ContainerConfigurator $container) {
20+
$container->services()
21+
->set('debug.event_dispatcher', TraceableEventDispatcher::class)
22+
->decorate('event_dispatcher')
23+
->args([
24+
service('debug.event_dispatcher.inner'),
25+
service('debug.stopwatch'),
26+
service('logger')->nullOnInvalid(),
27+
service('request_stack')->nullOnInvalid(),
28+
])
29+
->tag('monolog.logger', ['channel' => 'event'])
30+
->tag('kernel.reset', ['method' => 'reset'])
31+
32+
->set('debug.controller_resolver', TraceableControllerResolver::class)
33+
->decorate('controller_resolver')
34+
->args([
35+
service('debug.controller_resolver.inner'),
36+
service('debug.stopwatch'),
37+
])
38+
39+
->set('debug.argument_resolver', TraceableArgumentResolver::class)
40+
->decorate('argument_resolver')
41+
->args([
42+
service('debug.argument_resolver.inner'),
43+
service('debug.stopwatch'),
44+
])
45+
46+
->set('argument_resolver.not_tagged_controller', NotTaggedControllerValueResolver::class)
47+
->args([abstract_arg('Controller argument, set in FrameworkExtension')])
48+
->tag('controller.argument_value_resolver', ['priority' => -200])
49+
;
50+
};

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

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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\Debug\FileLinkFormatter;
15+
use Symfony\Component\HttpKernel\EventListener\DebugHandlersListener;
16+
17+
return static function (ContainerConfigurator $container) {
18+
$container->parameters()->set('debug.error_handler.throw_at', -1);
19+
20+
$container->services()
21+
->set('debug.debug_handlers_listener', DebugHandlersListener::class)
22+
->args([
23+
null, // Exception handler
24+
service('monolog.logger.php')->nullOnInvalid(),
25+
null, // Log levels map for enabled error levels
26+
param('debug.error_handler.throw_at'),
27+
param('kernel.debug'),
28+
service('debug.file_link_formatter'),
29+
param('kernel.debug'),
30+
service('monolog.logger.deprecation')->nullOnInvalid(),
31+
])
32+
->tag('kernel.event_subscriber')
33+
->tag('monolog.logger', ['channel' => 'php'])
34+
35+
->set('debug.file_link_formatter', FileLinkFormatter::class)
36+
->args([param('debug.file_link_format')])
37+
38+
->alias(FileLinkFormatter::class, 'debug.file_link_formatter')
39+
;
40+
};

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

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

0 commit comments

Comments
 (0)
0