Issues (9)

src/Console/Command/KickCommand.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Tarantool\JobQueue\Console\Command;
4
5
use Symfony\Component\Console\Input\InputArgument;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
class KickCommand extends Command
10
{
11
    protected function configure(): void
12
    {
13
        parent::configure();
14
15
        $this
16
            ->setName('kick')
17
            ->setDescription('Kicks buried tasks back to the queue')
18
            ->addArgument('count', InputArgument::REQUIRED)
19
        ;
20
    }
21
22
    protected function execute(InputInterface $input, OutputInterface $output): void
23
    {
24
        $queue = $this->createConfigFactory($input, $output)->createQueue();
25
        $count = $input->getArgument('count');
26
27
        $affected = $queue->kick($count);
0 ignored issues
show
$count of type null|string|string[] is incompatible with the type integer expected by parameter $count of Tarantool\Queue\Queue::kick(). ( Ignorable by Annotation )

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

27
        $affected = $queue->kick(/** @scrutinizer ignore-type */ $count);
Loading history...
28
29
        $output->writeln(sprintf(
30
            '<comment>%d</comment> tasks were successfully kicked back to <info>%s</info>.',
31
            $affected,
32
            $queue->getName()
33
        ));
34
    }
35
}
36