Issues (11)

src/Console/Command/Update.php (2 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ReliqArts\Docweaver\Console\Command;
6
7
use Carbon\Carbon;
8
use Illuminate\Console\Command;
9
10
class Update extends SingleProductCommand
11
{
12
    /**
13
     * The name and signature of the console command.
14
     *
15
     * @var string
16
     */
17
    protected $signature = 'docweaver:update
18
                            {product? : Product name}
19
                            {--y|y : Whether to skip confirmation}
20
                            ';
21
22
    /**
23
     * The console command description.
24
     *
25
     * @var string
26
     */
27
    protected $description = 'Update documentation for product';
28
29
    /**
30
     * Execute the console command.
31
     */
32
    public function handle(): void
33
    {
34
        $productName = $this->argument('product');
35
        $skipConfirmation = $this->option('y');
36
        $confirmationMessage = sprintf(
37
            "This command will attempt to update documentation for product (%s). \n"
38
            . 'Please ensure your internet connection is stable. Ready?',
39
            $productName
0 ignored issues
show
It seems like $productName can also be of type string[]; however, parameter $args of sprintf() 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

39
            /** @scrutinizer ignore-type */ $productName
Loading history...
40
        );
41
42
        $this->comment(PHP_EOL
43
            . "<info>♣♣♣</info> Docweaver DocumentationPublisher \n"
44
            . 'Help is here, try: php artisan docweaver:update --help');
45
46
        if ($skipConfirmation || $this->confirm($confirmationMessage)) {
47
            $this->info("Updating {$productName}.\nT: " . Carbon::now()->toCookieString() . "\n----------");
48
49
            $result = $this->publisher->update($productName, $this);
0 ignored issues
show
It seems like $productName can also be of type null and string[]; however, parameter $productName of ReliqArts\Docweaver\Cont...ion\Publisher::update() 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

49
            $result = $this->publisher->update(/** @scrutinizer ignore-type */ $productName, $this);
Loading history...
50
51
            $this->displayResult($result);
52
        }
53
    }
54
}
55