Migrator::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 4
1
<?php
2
3
namespace Schnittstabil\Dartisan;
4
5
use Illuminate\Database\ConnectionResolverInterface as Resolver;
6
use Illuminate\Database\Migrations\MigrationRepositoryInterface;
7
use Illuminate\Filesystem\Filesystem;
8
9
class Migrator extends \Illuminate\Database\Migrations\Migrator
10
{
11
    /**
12
     * @var Output
13
     */
14
    protected $dartisanOutput;
15
16
    public function __construct(
17
        MigrationRepositoryInterface $repository,
18
        Resolver $resolver,
19
        Filesystem $files,
20
        OutputInterface $output
21
    ) {
22
        parent::__construct($repository, $resolver, $files);
23
        $this->dartisanOutput = $output;
0 ignored issues
show
Documentation Bug introduced by
$output is of type object<Schnittstabil\Dartisan\OutputInterface>, but the property $dartisanOutput was declared to be of type object<Schnittstabil\Dartisan\Output>. 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...
24
    }
25
26
    protected function note($message): void
27
    {
28
        $this->dartisanOutput->raw($message);
29
    }
30
}
31