Skip to content

Commit 337faee

Browse files
committed
merged branch Tobion/deprecate-debuggerinterface (PR #8929)
This PR was merged into the master branch. Discussion ---------- [Templating] deprecate DebuggerInterface | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes: deprecated DebuggerInterface and Debugger | Tests pass? | yes | Fixed tickets | #8926 | License | MIT - [x] add suggested optional dependency in templating component to Psr log - [x] remove ProjectTemplateDebugger from tests Commits ------- b853438 [Templating] deprecate DebuggerInterface
2 parents 1041cf6 + 5439092 commit 337faee

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
1313

1414
use Symfony\Component\DependencyInjection\ContainerBuilder;
15+
use Symfony\Component\DependencyInjection\ContainerInterface;
1516
use Symfony\Component\DependencyInjection\DefinitionDecorator;
1617
use Symfony\Component\DependencyInjection\Reference;
1718
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
@@ -372,6 +373,15 @@ private function registerTemplatingConfiguration(array $config, $ide, ContainerB
372373
if ($container->getParameter('kernel.debug')) {
373374
$loader->load('templating_debug.xml');
374375

376+
$logger = new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE);
377+
378+
$container->getDefinition('templating.loader.cache')
379+
->addTag('monolog.logger', array('channel' => 'templating'))
380+
->addMethodCall('setLogger', array($logger));
381+
$container->getDefinition('templating.loader.chain')
382+
->addTag('monolog.logger', array('channel' => 'templating'))
383+
->addMethodCall('setLogger', array($logger));
384+
375385
$container->setDefinition('templating.engine.php', $container->findDefinition('debug.templating.engine.php'));
376386
$container->setAlias('debug.templating.engine.php', 'templating.engine.php');
377387
}

Resources/config/templating.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,9 @@
5252
<service id="templating.loader.cache" class="%templating.loader.cache.class%" public="false">
5353
<argument type="service" id="templating.loader.wrapped" />
5454
<argument>%templating.loader.cache.path%</argument>
55-
<call method="setDebugger"><argument type="service" id="templating.debugger" on-invalid="ignore" /></call>
5655
</service>
5756

5857
<service id="templating.loader.chain" class="%templating.loader.chain.class%" public="false">
59-
<call method="setDebugger"><argument type="service" id="templating.debugger" on-invalid="ignore" /></call>
6058
</service>
6159

6260
<service id="templating.loader" alias="templating.loader.filesystem" />

Resources/config/templating_debug.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@
55
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
66

77
<parameters>
8-
<parameter key="templating.debugger.class">Symfony\Bundle\FrameworkBundle\Templating\Debugger</parameter>
98
<parameter key="debug.templating.engine.php.class">Symfony\Bundle\FrameworkBundle\Templating\TimedPhpEngine</parameter>
109
</parameters>
1110

1211
<services>
13-
<service id="templating.debugger" class="%templating.debugger.class%" public="false">
14-
<tag name="monolog.logger" channel="templating" />
15-
<argument type="service" id="logger" on-invalid="null" />
16-
</service>
1712
<service id="debug.templating.engine.php" class="%debug.templating.engine.php.class%" public="false">
1813
<argument type="service" id="templating.name_parser" />
1914
<argument type="service" id="service_container" />

Templating/Debugger.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* Binds the Symfony templating loader debugger to the Symfony logger.
1919
*
2020
* @author Fabien Potencier <fabien@symfony.com>
21+
*
22+
* @deprecated Deprecated in 2.4, to be removed in 3.0. Use Psr\Log\LoggerInterface instead.
2123
*/
2224
class Debugger implements DebuggerInterface
2325
{

0 commit comments

Comments
 (0)