Issues (3)

DependencyInjection/Configuration.php (1 issue)

1
<?php
2
declare(strict_types=1);
3
4
namespace FH\Bundle\CookieGuardBundle\DependencyInjection;
5
6
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
7
use Symfony\Component\Config\Definition\ConfigurationInterface;
8
9
use function method_exists;
10
11
final class Configuration implements ConfigurationInterface
12
{
13
    private const ROOT_NAME = 'fh_cookie_guard';
14
15
    public function getConfigTreeBuilder(): TreeBuilder
16
    {
17
        $treeBuilder = new TreeBuilder(self::ROOT_NAME);
18
19
        if (method_exists($treeBuilder, 'getRootNode')) {
20
            $rootNode = $treeBuilder->getRootNode();
21
        } else {
22
            // BC layer for symfony/config 4.1 and older
23
            $rootNode = $treeBuilder->root(self::ROOT_NAME);
0 ignored issues
show
The method root() does not exist on Symfony\Component\Config...ion\Builder\TreeBuilder. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
            /** @scrutinizer ignore-call */ 
24
            $rootNode = $treeBuilder->root(self::ROOT_NAME);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
24
        }
25
26
        $rootNode
27
            ->children()
28
                ->scalarNode('cookie_name')
29
                    ->defaultValue('cookies-accepted')
30
                ->end()
31
            ->end();
32
33
        return $treeBuilder;
34
    }
35
}
36