Completed
Push — 3.x ( 55d76a...3d48b7 )
by Grégoire
07:09 queued 05:18
created

src/DependencyInjection/Configuration.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\DoctrineMongoDBAdminBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
/**
18
 * This class contains the configuration information for the bundle.
19
 *
20
 * This information is solely responsible for how the different configuration
21
 * sections are normalized, and merged.
22
 *
23
 * @author Michael Williams <[email protected]>
24
 */
25
class Configuration implements ConfigurationInterface
26
{
27
    /**
28
     * Generates the configuration tree.
29
     *
30
     * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder
31
     */
32
    public function getConfigTreeBuilder()
33
    {
34
        $treeBuilder = new TreeBuilder('sonata_doctrine_mongo_db_admin');
0 ignored issues
show
The call to TreeBuilder::__construct() has too many arguments starting with 'sonata_doctrine_mongo_db_admin'.

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.

Loading history...
35
36
        // Keep compatibility with symfony/config < 4.2
37
        if (!\method_exists($treeBuilder, 'getRootNode')) {
38
            $rootNode = $treeBuilder->root('sonata_doctrine_mongo_db_admin');
39
        } else {
40
            $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...
41
        }
42
43
        $rootNode
44
            ->children()
45
                ->arrayNode('templates')
46
                    ->addDefaultsIfNotSet()
47
                    ->children()
48
                        ->arrayNode('form')
49
                            ->prototype('scalar')->end()
50
                            ->defaultValue(['@SonataDoctrineMongoDBAdmin/Form/form_admin_fields.html.twig'])
51
                        ->end()
52
                        ->arrayNode('filter')
53
                            ->prototype('scalar')->end()
54
                            ->defaultValue(['@SonataDoctrineMongoDBAdmin/Form/filter_admin_fields.html.twig'])
55
                        ->end()
56
                        ->arrayNode('types')
57
                            ->children()
58
                                ->arrayNode('list')
59
                                    ->useAttributeAsKey('name')
60
                                    ->prototype('scalar')->end()
61
                                ->end()
62
                                ->arrayNode('show')
63
                                    ->useAttributeAsKey('name')
64
                                    ->prototype('scalar')->end()
65
                                ->end()
66
                            ->end()
67
                        ->end()
68
                    ->end()
69
                ->end()
70
            ->end()
71
        ;
72
73
        return $treeBuilder;
74
    }
75
}
76