| Conditions | 2 |
| Paths | 2 |
| Total Lines | 38 |
| Code Lines | 31 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function getConfigTreeBuilder(): TreeBuilder |
||
| 28 | { |
||
| 29 | if (method_exists(TreeBuilder::class, 'getRootNode')) { |
||
| 30 | $treeBuilder = new TreeBuilder('liip_functional_test'); |
||
| 31 | $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 | ->children() |
||
| 40 | ->scalarNode('command_verbosity')->defaultValue('normal')->end() |
||
| 41 | ->booleanNode('command_decoration')->defaultTrue()->end() |
||
| 42 | ->arrayNode('query') |
||
| 43 | ->addDefaultsIfNotSet() |
||
| 44 | ->children() |
||
| 45 | ->scalarNode('max_query_count') |
||
| 46 | ->defaultNull() |
||
| 47 | ->end() |
||
| 48 | ->end() |
||
| 49 | ->end() |
||
| 50 | ->arrayNode('authentication') |
||
| 51 | ->addDefaultsIfNotSet() |
||
| 52 | ->children() |
||
| 53 | ->scalarNode('username') |
||
| 54 | ->defaultValue('') |
||
| 55 | ->end() |
||
| 56 | ->scalarNode('password') |
||
| 57 | ->defaultValue('') |
||
| 58 | ->end() |
||
| 59 | ->end() |
||
| 60 | ->end() |
||
| 61 | ->end() |
||
| 62 | ; |
||
| 63 | |||
| 64 | 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.