diff --git a/src/Cli/ParallelController.php b/src/Cli/ParallelController.php index 860b032..368922c 100644 --- a/src/Cli/ParallelController.php +++ b/src/Cli/ParallelController.php @@ -193,12 +193,26 @@ private function startPoll(): void */ private function createTasks() { - $path = $this->input->hasArgument('paths') ? $this->input->getArgument('paths') : null; - if (! is_string($path) && $path !== null) { - throw new UnexpectedValue('Expected string or null'); + $paths = $this->input->hasArgument('paths') ? $this->input->getArgument('paths') : null; + + if (is_null($paths) || is_string($paths)) { + return $this->taskFactory->createTasks($this->input, $paths); + } + + if (!is_array($paths)) { + throw new UnexpectedValue('Expected array, string or null'); + } + + if (empty($paths)) { + return $this->taskFactory->createTasks($this->input, null); + } + + $tasks = []; + foreach ($paths as $path) { + $tasks = array_merge($tasks, $this->taskFactory->createTasks($this->input, $path)); } - return $this->taskFactory->createTasks($this->input, $path); + return $tasks; } /**