Test Failed
Push — master ( b6dff7...455f41 )
by Gabriel
12:43 queued 11s
created

HasApplication   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 32
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setApplication() 0 4 1
A getBootstrap() 0 4 1
A setBootstrap() 0 4 1
1
<?php
2
3
namespace Nip\Database\Manager;
4
5
use Nip\Application;
6
7
/**
8
 * Trait HasApplication
9
 * @package Nip\Database\Manager
10
 */
11
trait HasApplication
12
{
13
14
    /**
15
     * @var Application
16
     */
17
    protected $application;
18
19
    /**
20
     * @param Application $application
21
     */
22
    public function setApplication(Application $application)
23
    {
24
        $this->application = $application;
25
    }
26
27
    /**
28
     * @return Bootstrap
29
     */
30
    public function getBootstrap()
31
    {
32
        return $this->application;
33
    }
34
35
    /**
36
     * @param Bootstrap $bootstrap
37
     */
38
    public function setBootstrap($bootstrap)
39
    {
40
        $this->application = $bootstrap;
0 ignored issues
show
Documentation Bug introduced by
$bootstrap is of type object<Nip\Database\Manager\Bootstrap>, but the property $application was declared to be of type object<Nip\Application>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
41
    }
42
}
43