CheckExpansions::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
namespace Imanghafoori\LaravelMicroscope\Commands;
4
5
use Illuminate\Console\Command;
6
use Imanghafoori\LaravelMicroscope\Analyzers\ComposerJson;
7
use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter;
8
use Imanghafoori\LaravelMicroscope\GenerateCode;
9
use Imanghafoori\LaravelMicroscope\LaravelPaths\FilePath;
10
11
class CheckExpansions extends Command
12
{
13
    protected $signature = 'check:generate';
14
15
    protected $description = 'Generates code';
16
17
    public function handle(ErrorPrinter $errorPrinter)
18
    {
19
        $this->info('Scanning for Empty Provider Files');
20
        $errorPrinter->printer = $this->output;
21
22
        $autoload = ComposerJson::readAutoload();
23
24
        foreach ($autoload as $psr4Namespace => $psr4Path) {
25
            $files = FilePath::getAllPhpFiles($psr4Path);
26
            GenerateCode::serviceProvider($files, $psr4Path, $psr4Namespace, $this);
0 ignored issues
show
Documentation introduced by
$files is of type object<Symfony\Component\Finder\Finder>, but the function expects a object<Imanghafoori\LaravelMicroscope\iterable>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
27
        }
28
    }
29
}
30