Issues (2963)

app/Console/Kernel.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace App\Console;
4
5
use Illuminate\Console\Scheduling\Schedule;
6
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7
use LibreNMS\Util\Debug;
8
use LibreNMS\Util\Version;
9
10
class Kernel extends ConsoleKernel
11
{
12
    /**
13
     * The Artisan commands provided by your application.
14
     *
15
     * @var array
16
     */
17
    protected $commands = [
18
        //
19
    ];
20
21
    /**
22
     * Define the application's command schedule.
23
     *
24
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
25
     * @return void
26
     */
27
    protected function schedule(Schedule $schedule)
28
    {
29
        // $schedule->command('inspire')
30
        //          ->hourly();
31
    }
32
33
    /**
34
     * Register the commands for the application.
35
     *
36
     * @return void
37
     */
38
    protected function commands()
39
    {
40
        $this->load(__DIR__ . '/Commands');
41
42
        require base_path('routes/console.php');
43
44
        if ($this->app->environment() !== 'production') {
45
            require base_path('routes/dev-console.php');
46
        }
47
    }
48
49
    public function getArtisan()
50
    {
51
        if (is_null($this->artisan)) {
52
            parent::getArtisan();
53
            /** @phpstan-ignore-next-line */
54
            $this->artisan->setName(\LibreNMS\Config::get('project_name', 'LibreNMS'));
0 ignored issues
show
The method setName() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

54
            $this->artisan->/** @scrutinizer ignore-call */ 
55
                            setName(\LibreNMS\Config::get('project_name', 'LibreNMS'));

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...
55
            /** @phpstan-ignore-next-line */
56
            $this->artisan->setVersion(Version::get()->local());
57
        }
58
59
        return $this->artisan;
60
    }
61
62
    public function handle($input, $output = null)
63
    {
64
        // intercept input and check for debug
65
        if ($input->hasParameterOption(['-d', '--debug', '-vv', '-vvv'], true)) {
66
            if ($input->hasParameterOption(['-vvv'], true)) {
67
                Debug::setVerbose();
68
            }
69
            $this->app->booted('\LibreNMS\Util\Debug::set');
70
        }
71
72
        return parent::handle($input, $output);
73
    }
74
}
75