1 | <?php |
||||||
2 | |||||||
3 | declare(strict_types=1); |
||||||
4 | |||||||
5 | /* |
||||||
6 | * This file is part of the Liip/FunctionalTestBundle |
||||||
7 | * |
||||||
8 | * (c) Lukas Kahwe Smith <[email protected]> |
||||||
9 | * |
||||||
10 | * This source file is subject to the MIT license that is bundled |
||||||
11 | * with this source code in the file LICENSE. |
||||||
12 | */ |
||||||
13 | |||||||
14 | namespace Liip\FunctionalTestBundle\DependencyInjection; |
||||||
15 | |||||||
16 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||||||
17 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||||||
18 | |||||||
19 | /** |
||||||
20 | * This class contains the configuration information for the bundle. |
||||||
21 | */ |
||||||
22 | class Configuration implements ConfigurationInterface |
||||||
23 | { |
||||||
24 | /** |
||||||
25 | * {@inheritdoc} |
||||||
26 | */ |
||||||
27 | 1 | public function getConfigTreeBuilder(): TreeBuilder |
|||||
28 | { |
||||||
29 | 1 | if (method_exists(TreeBuilder::class, 'getRootNode')) { |
|||||
30 | 1 | $treeBuilder = new TreeBuilder('liip_functional_test'); |
|||||
31 | 1 | $rootNode = $treeBuilder->getRootNode(); |
|||||
32 | } else { |
||||||
33 | // BC layer for symfony/config 4.1 and older |
||||||
34 | $treeBuilder = new TreeBuilder(); |
||||||
0 ignored issues
–
show
|
|||||||
35 | $rootNode = $treeBuilder->root('liip_functional_test', 'array'); |
||||||
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
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. ![]() |
|||||||
36 | } |
||||||
37 | |||||||
38 | $rootNode |
||||||
39 | 1 | ->children() |
|||||
40 | 1 | ->scalarNode('command_verbosity')->defaultValue('normal')->end() |
|||||
41 | 1 | ->booleanNode('command_decoration')->defaultTrue()->end() |
|||||
42 | 1 | ->arrayNode('query') |
|||||
43 | 1 | ->addDefaultsIfNotSet() |
|||||
44 | 1 | ->children() |
|||||
45 | 1 | ->scalarNode('max_query_count') |
|||||
46 | 1 | ->defaultNull() |
|||||
47 | 1 | ->end() |
|||||
48 | 1 | ->end() |
|||||
49 | 1 | ->end() |
|||||
50 | 1 | ->arrayNode('authentication') |
|||||
51 | 1 | ->addDefaultsIfNotSet() |
|||||
52 | 1 | ->children() |
|||||
53 | 1 | ->scalarNode('username') |
|||||
54 | 1 | ->defaultValue('') |
|||||
55 | 1 | ->end() |
|||||
56 | 1 | ->scalarNode('password') |
|||||
57 | 1 | ->defaultValue('') |
|||||
58 | 1 | ->end() |
|||||
59 | 1 | ->end() |
|||||
60 | 1 | ->end() |
|||||
61 | 1 | ->end() |
|||||
62 | ; |
||||||
63 | |||||||
64 | 1 | return $treeBuilder; |
|||||
65 | } |
||||||
66 | } |
||||||
67 |
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.