mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-09 00:46:31 +00:00
c649c1658b
* 3.x: CS fixes Enable Fabbot as a GHA
33 lines
1.2 KiB
PHP
33 lines
1.2 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Twig.
|
|
*
|
|
* (c) Fabien Potencier
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Twig\Extra\TwigExtraBundle\DependencyInjection\Compiler;
|
|
|
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
use Symfony\Component\DependencyInjection\Reference;
|
|
|
|
class MissingExtensionSuggestorPass implements CompilerPassInterface
|
|
{
|
|
public function process(ContainerBuilder $container): void
|
|
{
|
|
if (!$container->getParameter('kernel.debug')) {
|
|
return;
|
|
}
|
|
$twigDefinition = $container->getDefinition('twig');
|
|
$twigDefinition
|
|
->addMethodCall('registerUndefinedFilterCallback', [[new Reference('twig.missing_extension_suggestor'), 'suggestFilter']])
|
|
->addMethodCall('registerUndefinedFunctionCallback', [[new Reference('twig.missing_extension_suggestor'), 'suggestFunction']])
|
|
->addMethodCall('registerUndefinedTokenParserCallback', [[new Reference('twig.missing_extension_suggestor'), 'suggestTag']])
|
|
;
|
|
}
|
|
}
|