Completed
Push — master ( fcdb68...d209bc )
by Vladimir
02:46
created

BaseManager::setConsoleOutput()   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
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
crap 1
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
use Symfony\Component\Console\Output\OutputInterface;
10
11
abstract class BaseManager implements LoggerAwareInterface
12
{
13
    /**
14
     * @var StakxLogger
15
     */
16
    protected $output;
17
18
    /**
19
     * @var Filesystem
20
     */
21
    protected $fs;
22
23 4
    public function __construct ()
24
    {
25 4
        $this->fs = new Filesystem();
26 4
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function setLogger(LoggerInterface $logger)
32
    {
33
        $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...
34
    }
35
}