Completed
Push — master ( afce1d...f8221d )
by Vladimir
09:37
created

Factory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 12
ccs 0
cts 5
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Foundation;
6
7
use FondBot\Providers\DriverServiceProvider;
8
use Illuminate\Contracts\Foundation\Application;
9
10
class Factory
11
{
12
    public static function create(Application $application): Kernel
13
    {
14
        // Load service providers
15
        $application->register(DriverServiceProvider::class);
16
17
        // Boot kernel
18
        $kernel = Kernel::createInstance($application);
19
20
        $application->singleton(Kernel::class, $kernel);
0 ignored issues
show
Documentation introduced by
$kernel is of type object<FondBot\Foundation\Kernel>, but the function expects a object<Closure>|string|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
21
22
        return $kernel;
23
    }
24
}
25