These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * This file is part of the Sonata Project package. |
||
7 | * |
||
8 | * (c) Thomas Rabaix <[email protected]> |
||
9 | * |
||
10 | * For the full copyright and license information, please view the LICENSE |
||
11 | * file that was distributed with this source code. |
||
12 | */ |
||
13 | |||
14 | namespace Sonata\DoctrinePHPCRAdminBundle\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 | * This information is solely responsible for how the different configuration |
||
23 | * sections are normalized, and merged. |
||
24 | * |
||
25 | * @author Michael Williams <[email protected]> |
||
26 | */ |
||
27 | class Configuration implements ConfigurationInterface |
||
28 | { |
||
29 | /** |
||
30 | * Generates the configuration tree. |
||
31 | * |
||
32 | * @return TreeBuilder |
||
33 | */ |
||
34 | public function getConfigTreeBuilder() |
||
35 | { |
||
36 | $treeBuilder = new TreeBuilder('sonata_doctrine_phpcr_admin'); |
||
0 ignored issues
–
show
|
|||
37 | |||
38 | // Keep compatibility with symfony/config < 4.2 |
||
39 | if (!method_exists($treeBuilder, 'getRootNode')) { |
||
40 | $rootNode = $treeBuilder->root('sonata_doctrine_phpcr_admin'); |
||
41 | } else { |
||
42 | $rootNode = $treeBuilder->getRootNode(); |
||
0 ignored issues
–
show
The method
getRootNode() does not seem to exist on object<Symfony\Component...on\Builder\TreeBuilder> .
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.
Loading history...
|
|||
43 | } |
||
44 | |||
45 | $rootNode |
||
46 | ->fixXmlConfig('template') |
||
47 | ->children() |
||
48 | ->arrayNode('templates') |
||
49 | ->children() |
||
50 | ->arrayNode('form') |
||
51 | ->prototype('scalar')->end() |
||
52 | ->defaultValue(['@SonataDoctrinePHPCRAdmin/Form/form_admin_fields.html.twig']) |
||
53 | ->end() |
||
54 | ->arrayNode('filter') |
||
55 | ->prototype('scalar')->end() |
||
56 | ->defaultValue(['@SonataDoctrinePHPCRAdmin/Form/filter_admin_fields.html.twig']) |
||
57 | ->end() |
||
58 | ->arrayNode('types') |
||
59 | ->children() |
||
60 | ->arrayNode('list') |
||
61 | ->useAttributeAsKey('name') |
||
62 | ->prototype('scalar')->end() |
||
63 | ->end() |
||
64 | ->arrayNode('show') |
||
65 | ->useAttributeAsKey('name') |
||
66 | ->prototype('scalar')->end() |
||
67 | ->end() |
||
68 | ->end() |
||
69 | ->end() |
||
70 | ->scalarNode('pager_results')->defaultValue('@SonataDoctrinePHPCRAdmin/Pager/simple_pager_results.html.twig')->cannotBeEmpty()->end() |
||
71 | ->end() |
||
72 | ->end() |
||
73 | ->arrayNode('document_tree') |
||
74 | ->addDefaultsIfNotSet() |
||
75 | ->canBeEnabled() |
||
76 | ->children() |
||
77 | ->scalarNode('repository_name') |
||
78 | ->defaultNull() |
||
79 | ->info('The repository name the resource API connects to.') |
||
80 | ->end() |
||
81 | ->arrayNode('routing_defaults') |
||
82 | ->prototype('scalar')->end() |
||
83 | ->info('Routing defaults passed to the resources API call.') |
||
84 | ->end() |
||
85 | ->scalarNode('sortable_by') |
||
86 | ->defaultValue('position') |
||
87 | ->info('Defines by which property to sort sibling documents.') |
||
88 | ->end() |
||
89 | ->end() |
||
90 | ->end() |
||
91 | ->end() |
||
92 | ; |
||
93 | |||
94 | return $treeBuilder; |
||
95 | } |
||
96 | } |
||
97 |
This check compares calls to functions or methods with their respective definitions. If the call has more 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.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.