CheckExpansions   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 12 2
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