Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 17
rs 9.9332
cc 2
nc 2
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace KunicMarko\SonataAnnotationBundle\DependencyInjection;
6
7
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
8
use Symfony\Component\Config\Definition\ConfigurationInterface;
9
10
/**
11
 * @author Marko Kunic <[email protected]>
12
 */
13
final class Configuration implements ConfigurationInterface
14
{
15
    public function getConfigTreeBuilder(): TreeBuilder
16
    {
17
        $treeBuilder = new TreeBuilder('sonata_annotation');
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('sonata_annotation');
0 ignored issues
show
Deprecated Code introduced by
The function Symfony\Component\Config...der\TreeBuilder::root() has been deprecated: since Symfony 4.3, pass the root name to the constructor instead ( Ignorable by Annotation )

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

23
            $rootNode = /** @scrutinizer ignore-deprecated */ $treeBuilder->root('sonata_annotation');

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
24
        }
25
26
        $rootNode
27
            ->children()
28
                ->scalarNode('directory')->defaultNull()->end()
29
            ->end();
30
31
        return $treeBuilder;
32
    }
33
}
34