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\DoctrineMongoDBAdminBundle\DependencyInjection; |
||
15 | |||
16 | use Sonata\AdminBundle\DependencyInjection\AbstractSonataAdminExtension; |
||
17 | use Symfony\Component\Config\Definition\Processor; |
||
18 | use Symfony\Component\Config\FileLocator; |
||
19 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
||
20 | use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; |
||
21 | |||
22 | /** |
||
23 | * @author Thomas Rabaix <[email protected]> |
||
24 | * @author Michael Williams <[email protected]> |
||
25 | */ |
||
26 | class SonataDoctrineMongoDBAdminExtension extends AbstractSonataAdminExtension |
||
27 | { |
||
28 | /** |
||
29 | * @param array $configs An array of configuration settings |
||
30 | * @param ContainerBuilder $container A ContainerBuilder instance |
||
31 | */ |
||
32 | public function load(array $configs, ContainerBuilder $container): void |
||
33 | { |
||
34 | $configs = $this->fixTemplatesConfiguration($configs, $container); |
||
35 | |||
36 | $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
||
37 | $loader->load('doctrine_mongodb.xml'); |
||
38 | $loader->load('doctrine_mongodb_filter_types.xml'); |
||
39 | $loader->load('security.xml'); |
||
40 | |||
41 | $configuration = new Configuration(); |
||
42 | $processor = new Processor(); |
||
43 | $config = $processor->processConfiguration($configuration, $configs); |
||
44 | |||
45 | $pool = $container->getDefinition('sonata.admin.manager.doctrine_mongodb'); |
||
0 ignored issues
–
show
|
|||
46 | |||
47 | $container->setParameter('sonata_doctrine_mongodb_admin.templates', $config['templates']); |
||
48 | |||
49 | // define the templates |
||
50 | $container->getDefinition('sonata.admin.builder.doctrine_mongodb_list') |
||
51 | ->replaceArgument(1, $config['templates']['types']['list']); |
||
52 | |||
53 | $container->getDefinition('sonata.admin.builder.doctrine_mongodb_show') |
||
54 | ->replaceArgument(1, $config['templates']['types']['show']); |
||
55 | } |
||
56 | } |
||
57 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.