GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#249)
by Théo
35:08
created

compile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
use Symfony\Component\DependencyInjection\ContainerInterface;
4
use Symfony\Component\DependencyInjection\Container;
5
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, InvalidArgumentException.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
6
use Symfony\Component\DependencyInjection\Exception\LogicException;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, LogicException.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
7
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, RuntimeException.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
8
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
9
10
/**
11
 * ResolverTestReturnsAllBundlesIfNoBundleIsRequestedDebugProjectContainer.
12
 *
13
 * This class has been auto-generated
14
 * by the Symfony Dependency Injection Component.
15
 */
16 View Code Duplication
class ResolverTestReturnsAllBundlesIfNoBundleIsRequestedDebugProjectContainer extends Container
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
17
{
18
    private $parameters;
19
    private $targetDirs = array();
20
21
    /**
22
     * Constructor.
23
     */
24
    public function __construct()
25
    {
26
        $dir = __DIR__;
27
        for ($i = 1; $i <= 5; ++$i) {
28
            $this->targetDirs[$i] = $dir = dirname($dir);
29
        }
30
        $this->parameters = $this->getDefaultParameters();
31
32
        $this->services = array();
33
34
        $this->aliases = array();
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function compile()
41
    {
42
        throw new LogicException('You cannot compile a dumped frozen container.');
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function isFrozen()
49
    {
50
        return true;
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function getParameter($name)
57
    {
58
        $name = strtolower($name);
59
60
        if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters))) {
61
            throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
62
        }
63
64
        return $this->parameters[$name];
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function hasParameter($name)
71
    {
72
        $name = strtolower($name);
73
74
        return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters);
75
    }
76
77
    /**
78
     * {@inheritdoc}
79
     */
80
    public function setParameter($name, $value)
81
    {
82
        throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
83
    }
84
85
    /**
86
     * {@inheritdoc}
87
     */
88
    public function getParameterBag()
89
    {
90
        if (null === $this->parameterBag) {
91
            $this->parameterBag = new FrozenParameterBag($this->parameters);
92
        }
93
94
        return $this->parameterBag;
95
    }
96
97
    /**
98
     * Gets the default parameters.
99
     *
100
     * @return array An array of the default parameters
101
     */
102
    protected function getDefaultParameters()
103
    {
104
        return array(
105
            'kernel.root_dir' => $this->targetDirs[2],
106
            'kernel.environment' => 'testReturnsAllBundlesIfNoBundleIsRequested',
107
            'kernel.debug' => true,
108
            'kernel.name' => 'Resolver',
109
            'kernel.cache_dir' => __DIR__,
110
            'kernel.logs_dir' => ($this->targetDirs[2].'/logs'),
111
            'kernel.bundles' => array(
112
                'ABundle' => 'Hautelook\\AliceBundle\\Resolver\\ABundle',
113
                'BBundle' => 'Hautelook\\AliceBundle\\Resolver\\BBundle',
114
            ),
115
            'kernel.charset' => 'UTF-8',
116
            'kernel.container_class' => 'ResolverTestReturnsAllBundlesIfNoBundleIsRequestedDebugProjectContainer',
117
            'database.name' => 'alice',
118
            'database.user' => 'root',
119
            'database.password' => '',
120
        );
121
    }
122
}
123