Passed
Push — master ( ec5386...e56f88 )
by Andrey
53s queued 14s
created

DoNothing   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Endpoint\Console;
6
7
use Spiral\Console\Attribute\Argument;
0 ignored issues
show
Bug introduced by
The type Spiral\Console\Attribute\Argument was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Spiral\Console\Attribute\AsCommand;
0 ignored issues
show
Bug introduced by
The type Spiral\Console\Attribute\AsCommand was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Spiral\Console\Attribute\Option;
0 ignored issues
show
Bug introduced by
The type Spiral\Console\Attribute\Option was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Spiral\Console\Attribute\Question;
0 ignored issues
show
Bug introduced by
The type Spiral\Console\Attribute\Question was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Spiral\Console\Command;
0 ignored issues
show
Bug introduced by
The type Spiral\Console\Command was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Symfony\Component\Console\Input\InputOption;
13
14
/**
15
 * Simple command that does nothing, but demonstrates how to use arguments and options.
16
 *
17
 * To execute this command run:
18
 * php app.php do-nothing foo --times=20
19
 *
20
 * Run `php app.php help do-nothing` to see all available options.
21
 *
22
 * @psalm-suppress PropertyNotSetInConstructor
23
 */
24
#[AsCommand(name: 'do-nothing', description: 'The command does nothing.')]
25
final class DoNothing extends Command
26
{
27
    #[Argument(description: 'Task name')]
28
    #[Question(question: 'Provide task name')]
29
    private string $name;
30
31
    #[Option(shortcut: 't', description: 'Number of times to repeat')]
32
    private int $times = 10;
33
34
    public function __invoke(): int
35
    {
36
        $this->info(\sprintf(
37
            'The task "%s" has been successfully completed "%d" times!',
38
            $this->name,
39
            $this->times
40
        ));
41
42
        return self::SUCCESS;
43
    }
44
}
45