Skip to content

Commit 009f43f

Browse files
committed
fix from review
1 parent 67707f6 commit 009f43f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Symfony/Component/Scheduler/Command/DebugCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,19 @@
3131
#[AsCommand(name: 'debug:scheduler', description: 'List schedules and their jobs')]
3232
final class DebugCommand extends Command
3333
{
34+
private array $scheduleNames;
35+
3436
public function __construct(private ServiceProviderInterface $schedules)
3537
{
38+
$this->scheduleNames = array_keys($this->schedules->getProvidedServices());
39+
3640
parent::__construct();
3741
}
3842

3943
protected function configure(): void
4044
{
4145
$this
42-
->addArgument('schedule', InputArgument::OPTIONAL, sprintf('The schedule name (one of "%s")', implode('", "', array_keys($this->schedules->getProvidedServices()))))
46+
->addArgument('schedule', InputArgument::OPTIONAL|InputArgument::IS_ARRAY, sprintf('The schedule name (one of "%s")', implode('", "', $this->scheduleNames)), null, $this->scheduleNames)
4347
->setHelp(<<<'EOF'
4448
The <info>%command.name%</info> lists schedules and their jobs:
4549
@@ -59,7 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5963
$io = new SymfonyStyle($input, $output);
6064
$io->title('Scheduler');
6165

62-
$names = (array) ($input->getArgument('schedule') ?? array_keys($this->schedules->getProvidedServices()));
66+
$names = $input->getArgument('schedule') ?: $this->scheduleNames;
6367

6468
foreach ($names as $name) {
6569
/** @var ScheduleProviderInterface $schedule */

0 commit comments

Comments
 (0)