These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Spatie\EventProjector\Console; |
||
4 | |||
5 | use Illuminate\Console\Command; |
||
6 | use Spatie\EventProjector\Projectionist; |
||
7 | use Spatie\EventProjector\Console\Concerns\SelectsProjectors; |
||
8 | |||
9 | View Code Duplication | class ResetCommand extends Command |
|
10 | { |
||
11 | use SelectsProjectors; |
||
12 | |||
13 | protected $signature = 'event-projector:reset {projector*} |
||
14 | {--force : Force the operation to run when in production}'; |
||
15 | |||
16 | protected $description = 'Reset a projector'; |
||
17 | |||
18 | /** @var \Spatie\EventProjector\Projectionist */ |
||
19 | protected $projectionist; |
||
20 | |||
21 | public function __construct(Projectionist $projectionist) |
||
22 | { |
||
23 | parent::__construct(); |
||
24 | |||
25 | $this->projectionist = $projectionist; |
||
26 | } |
||
27 | |||
28 | public function handle() |
||
29 | { |
||
30 | $projectors = $this->selectsProjectors($this->argument('projector'), 'Are you sure to reset all projectors?'); |
||
0 ignored issues
–
show
|
|||
31 | |||
32 | if (is_null($projectors)) { |
||
33 | $this->warn('No projectors reset!'); |
||
34 | |||
35 | return; |
||
36 | } |
||
37 | |||
38 | $projectors->each->reset(); |
||
39 | |||
40 | $this->comment('Projector(s) reset!'); |
||
41 | } |
||
42 | } |
||
43 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.