Completed
Pull Request — master (#6)
by Tomáš
05:31
created

KernelFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 22
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 19 2
1
<?php
2
3
/*
4
 * This file is a part of Sculpin.
5
 *
6
 * (c) Dragonfly Development Inc.
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
namespace Symplify\PHP7_Sculpin\Bundle\SculpinBundle\HttpKernel;
13
14
use Symfony\Component\HttpKernel\KernelInterface;
15
16
final class KernelFactory
17
{
18
    public static function create() : KernelInterface
19
    {
20
        $env = 'debug';
21
        $debug = true;
22
23
        // We are relying on our calling script to chdir as appropriate with any
24
        // --project-directory that was specified.
25
        $projectDir = getcwd();
26
27
        if (file_exists($customKernel = $projectDir.'/app/SculpinKernel.php')) {
28
            require $customKernel;
29
30
            return new \SculpinKernel($env, $debug, $projectDir);
31
        }
32
33
        // Fallback to using the default kernel in case
34
        // user does not define their own kernel somehow.
35
        return new DefaultKernel($env, $debug, $projectDir);
0 ignored issues
show
Documentation introduced by
$debug is of type boolean, but the function expects a string.

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...
36
    }
37
}
38