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
Push — master ( d2fb2a...21b498 )
by Alex
37:14 queued 17:17
created

ConsoleExtension::isPhar()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of the ApiGen (http://apigen.org)
5
 *
6
 * For the full copyright and license information, please view
7
 * the file LICENSE that was distributed with this source code.
8
 */
9
10
namespace ApiGen\Console\DI;
11
12
use ApiGen\Console\Application;
13
use Nette\DI\CompilerExtension;
14
use Symfony\Component\Console\Command\Command;
15
16 View Code Duplication
class ConsoleExtension extends CompilerExtension
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...
17
{
18
19
    public function loadConfiguration()
20
    {
21
        $builder = $this->getContainerBuilder();
22
        $services = $this->loadFromFile(__DIR__ . '/services.neon');
23
        $this->compiler->parseServices($builder, $services);
0 ignored issues
show
Bug introduced by
It seems like $services defined by $this->loadFromFile(__DIR__ . '/services.neon') on line 22 can also be of type string; however, Nette\DI\Compiler::parseServices() does only seem to accept array, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
Deprecated Code introduced by
The method Nette\DI\Compiler::parseServices() has been deprecated.

This method has been deprecated.

Loading history...
24
    }
25
26
27
    public function beforeCompile()
28
    {
29
        $builder = $this->getContainerBuilder();
30
        $builder->prepareClassList();
31
32
        $application = $builder->getDefinition($builder->getByType(Application::class));
33
        foreach ($builder->findByType(Command::class) as $definition) {
34
            $application->addSetup('add', ['@' . $definition->getClass()]);
35
        }
36
    }
37
}
38