Conditions | 2 |
Paths | 2 |
Total Lines | 38 |
Code Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Tests | 28 |
CRAP Score | 2.0011 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
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(); |
||
|
|||
35 | $rootNode = $treeBuilder->root('liip_functional_test', 'array'); |
||
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 | } |
||
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.