Conditions | 2 |
Paths | 2 |
Total Lines | 27 |
Code Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public function getConfigTreeBuilder() |
||
20 | { |
||
21 | if (\method_exists(TreeBuilder::class, 'getRootNode')) { |
||
22 | $treeBuilder = new TreeBuilder('data_grid'); |
||
23 | $rootNode = $treeBuilder->getRootNode(); |
||
24 | } else { |
||
25 | // BC layer for symfony/config 4.1 and older |
||
26 | $treeBuilder = new TreeBuilder(); |
||
|
|||
27 | $rootNode = $treeBuilder->root('data_grid'); |
||
28 | } |
||
29 | $rootNode |
||
30 | ->children() |
||
31 | ->arrayNode('instances') |
||
32 | ->normalizeKeys(false) |
||
33 | ->useAttributeAsKey('name') |
||
34 | ->arrayPrototype() |
||
35 | ->children() |
||
36 | ->scalarNode('template')->defaultValue('@DataGrid/grid.blocks.html.twig')->end() |
||
37 | ->scalarNode('no_data_message')->defaultValue('No data found')->end() |
||
38 | ->booleanNode('pagination_enabled')->defaultValue(true)->end() |
||
39 | ->integerNode('pagination_limit')->defaultValue(10)->end() |
||
40 | ->scalarNode('translation_domain')->defaultNull()->end() |
||
41 | ->end() |
||
42 | ->end() |
||
43 | ->end(); |
||
44 | |||
45 | return $treeBuilder; |
||
46 | } |
||
48 |
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.