From cc46963d14a832203f167a3da6cfa2470a05a47c Mon Sep 17 00:00:00 2001 From: David Gegelija Date: Thu, 17 Jul 2025 11:57:46 +0300 Subject: [PATCH 1/2] Fix `paths` argument handling --- src/Cli/ParallelController.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Cli/ParallelController.php b/src/Cli/ParallelController.php index 860b032..aecf9e0 100644 --- a/src/Cli/ParallelController.php +++ b/src/Cli/ParallelController.php @@ -193,12 +193,21 @@ 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_array($paths) && $paths !== null) { + throw new UnexpectedValue('Expected array or null'); } - return $this->taskFactory->createTasks($this->input, $path); + 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 $tasks; } /** From 065a268938784684bf1f382569e2945409316570 Mon Sep 17 00:00:00 2001 From: David Gegelija Date: Fri, 18 Jul 2025 08:53:44 +0300 Subject: [PATCH 2/2] Add string case in `paths` argument handling --- src/Cli/ParallelController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Cli/ParallelController.php b/src/Cli/ParallelController.php index aecf9e0..368922c 100644 --- a/src/Cli/ParallelController.php +++ b/src/Cli/ParallelController.php @@ -194,8 +194,13 @@ private function startPoll(): void private function createTasks() { $paths = $this->input->hasArgument('paths') ? $this->input->getArgument('paths') : null; - if (!is_array($paths) && $paths !== null) { - throw new UnexpectedValue('Expected array or 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)) {