Issues (26)

src/Hook/MakeHookCommand.php (3 issues)

1
<?php
2
3
namespace CleaniqueCoders\Console\Hook;
4
5
use CleaniqueCoders\Console\Commander;
6
use Illuminate\Support\Str;
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class MakeHookCommand extends Commander
12
{
13
    /**
14
     * Configure the command options.
15
     */
16
    protected function configure()
17
    {
18
        $this
19
            ->setName('hook')
20
            ->setDescription('Hook package to a Laravel project locally')
21
            ->addArgument('name', InputArgument::REQUIRED)
22
            ->addArgument('to', InputArgument::REQUIRED);
23
    }
24
25
    /**
26
     * Execute the command.
27
     */
28
    protected function execute(InputInterface $input, OutputInterface $output)
29
    {
30
        $name      = $input->getArgument('name');
31
        $pathOrUrl = $input->getArgument('to');
32
33
        $status = $this->composerLink(Str::snake($name), $pathOrUrl);
0 ignored issues
show
It seems like $name can also be of type string[]; however, parameter $value of Illuminate\Support\Str::snake() 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

33
        $status = $this->composerLink(Str::snake(/** @scrutinizer ignore-type */ $name), $pathOrUrl);
Loading history...
It seems like $pathOrUrl can also be of type string[]; however, parameter $pathOrUrl of CleaniqueCoders\Console\Commander::composerLink() 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

33
        $status = $this->composerLink(Str::snake($name), /** @scrutinizer ignore-type */ $pathOrUrl);
Loading history...
34
35
        if ($status) {
0 ignored issues
show
The condition $status is always true.
Loading history...
36
            $output->writeln('<info>Packaged linked.</info>');
37
        } else {
38
            $output->writeln('<comment>Unable to link the package.</comment>');
39
        }
40
    }
41
}
42