Completed
Push — master ( dafc3a...b25186 )
by Vladimir
02:19
created

BaseManager::setLogger()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace allejo\stakx\Manager;
4
5
use allejo\stakx\Core\StakxLogger;
6
use allejo\stakx\System\Filesystem;
7
use Psr\Log\LoggerAwareInterface;
8
use Psr\Log\LoggerInterface;
9
10
abstract class BaseManager implements LoggerAwareInterface
11
{
12
    /**
13
     * @var StakxLogger
14
     */
15
    protected $output;
16
17
    /**
18
     * @var Filesystem
19
     */
20
    protected $fs;
21
22 4
    public function __construct ()
23
    {
24 4
        $this->fs = new Filesystem();
25 4
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 4
    public function setLogger(LoggerInterface $logger)
31
    {
32 4
        $this->output = $logger;
0 ignored issues
show
Documentation Bug introduced by
$logger is of type object<Psr\Log\LoggerInterface>, but the property $output was declared to be of type object<allejo\stakx\Core\StakxLogger>. 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...
33
    }
34
}