Passed
Push — main ( d6cdce...b163db )
by Oscar
16:28 queued 15:04
created

SuggestMissingExtensionPass::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 8
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 11
ccs 0
cts 10
cp 0
crap 6
rs 10
1
<?php
2
3
/*
4
 * This file is part of ocubom/twig-extra-bundle
5
 *
6
 * © Oscar Cubo Medina <https://ocubom.github.io>
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 Ocubom\TwigExtraBundle\DependencyInjection\Compiler;
13
14
use Ocubom\TwigExtraBundle\Extensions;
15
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
1 ignored issue
show
Bug introduced by
The type Symfony\Component\Depend...ection\ContainerBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
18
class SuggestMissingExtensionPass implements CompilerPassInterface
19
{
20
    public function process(ContainerBuilder $container): void
21
    {
22
        if ($container->getParameter('kernel.debug')) {
23
            $container->getDefinition('twig')
24
                ->addMethodCall(
25
                    'registerUndefinedFilterCallback',
26
                    [[Extensions::class, 'suggestFilter']]
27
                )
28
                ->addMethodCall(
29
                    'registerUndefinedFunctionCallback',
30
                    [[Extensions::class, 'suggestFunction']]
31
                )
32
            ;
33
        }
34
    }
35
}
36