Skip to content
This repository was archived by the owner on Mar 20, 2025. It is now read-only.

Commit 9417cf2

Browse files
committed
Correct option type + handle empty config
1 parent 67bf9bb commit 9417cf2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Commands/RunCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ protected function configure(): void
3333
{
3434
$this->addArgument('task', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'The name of the automated task');
3535
$this->addOption('dirty', mode: InputOption::VALUE_NONE, description: 'Scan only dirty files');
36-
$this->addOption('path', mode: InputOption::VALUE_REQUIRED | InputArgument::OPTIONAL, description: 'The paths to scan');
36+
$this->addOption('path', mode: InputOption::VALUE_REQUIRED | InputArgument::OPTIONAL | InputOption::VALUE_IS_ARRAY, description: 'The paths to scan');
3737
}
3838

3939
protected function execute(InputInterface $input, OutputInterface $output): int
4040
{
41-
$tasks = empty($input->getArgument('task')) ? Configuration::get('tasks') : $input->getArgument('task');
41+
$tasks = empty($input->getArgument('task')) ? Configuration::get('tasks', []) : $input->getArgument('task');
4242

4343
foreach ($tasks as $task) {
4444
$result = ($this->createTask($this->taskRegistry($task), $input))->perform();
@@ -61,7 +61,7 @@ private function createTask(string $name, InputInterface $input): Task
6161
$task = new $name;
6262

6363
if (in_array(FindsFiles::class, class_uses_recursive($task))) {
64-
if ($input->getOption('path')) {
64+
if (! empty($input->getOption('path'))) {
6565
$task->setPaths($input->getOption('path'));
6666
}
6767

0 commit comments

Comments
 (0)