Migrator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A note() 0 4 1
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