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.
Failed Conditions
Push — develop ( 97d950...17c62d )
by Maxime
19:32
created

Commands/Development/ConfigurationCommand.php (1 issue)

Labels
Severity

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 Rocketeer
5
 *
6
 * (c) Maxime Fabre <[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
13
namespace Rocketeer\Console\Commands\Development;
14
15
use Illuminate\Support\Arr;
16
use Rocketeer\Console\Commands\AbstractCommand;
17
use Symfony\Component\Console\Input\InputArgument;
18
use Symfony\Component\VarDumper\Cloner\VarCloner;
19
use Symfony\Component\VarDumper\Dumper\CliDumper;
20
21
/**
22
 * Easily dump one or more nodes from the configuration.
23
 */
24
class ConfigurationCommand extends AbstractCommand
25
{
26
    /**
27
     * The console command name.
28
     *
29
     * @var string
30
     */
31
    protected $name = 'debug:config';
32
33
    /**
34
     * @var string
35
     */
36
    protected $description = 'Dumps the current configuration parsed';
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function fire()
42
    {
43
        $this->prepareEnvironment();
44
        $key = $this->argument('key');
45
46
        $configuration = $this->config->all();
47
        $configuration = $key ? Arr::get($configuration, $key) : $configuration;
0 ignored issues
show
It seems like $key defined by $this->argument('key') on line 44 can also be of type array; however, Illuminate\Support\Arr::get() does only seem to accept string, 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...
48
49
        $dumper = new CliDumper();
50
        $dumper->setColors(true);
51
52
        $cloner = new VarCloner();
53
54
        $dumper->dump($cloner->cloneVar($configuration), function ($line, $depth) {
55
            if ($depth !== -1) {
56
                $this->output->writeln(str_repeat('  ', $depth).$line);
57
            }
58
        });
59
    }
60
61
    /**
62
     * @return array
63
     */
64
    protected function getArguments()
65
    {
66
        return [
67
            ['key', InputArgument::OPTIONAL, 'The key to dump'],
68
        ];
69
    }
70
}
71