Issues (65)

src/Commands/Other/UpdateCommand.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Rawilk\LaravelModules\Commands\Other;
4
5
use Illuminate\Console\Command;
6
7
class UpdateCommand extends Command
8
{
9
    /** @var string */
10
    protected $signature = 'module:update
11
                            {module? : The name of the module to update}';
12
13
    /** @var string */
14
    protected $description = 'Update dependencies for a specific module or all modules.';
15
16
    public function handle(): void
17
    {
18
        if ($name = $this->argument('module')) {
19
            $this->updateModule($name);
0 ignored issues
show
It seems like $name can also be of type string[]; however, parameter $name of Rawilk\LaravelModules\Co...Command::updateModule() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

19
            $this->updateModule(/** @scrutinizer ignore-type */ $name);
Loading history...
20
21
            return;
22
        }
23
24
        /** @var \Rawilk\LaravelModules\Module $module */
25
        foreach ($this->laravel['modules']->getOrdered() as $module) {
26
            $this->updateModule($module->getName());
27
        }
28
    }
29
30
    private function updateModule(string $name): void
31
    {
32
        $this->line("Updating module: <info>{$name}</info>");
33
34
        $this->laravel['modules']->update($name);
35
36
        $this->info("Module [{$name}] updated successfully.");
37
    }
38
}
39