From 18a16e6a744d8773fd7ad063354d494f9df549c7 Mon Sep 17 00:00:00 2001 From: PHP CS Fixer Date: Tue, 6 Aug 2024 01:31:16 +0000 Subject: [PATCH] Fix code style (php-cs-fixer) --- src/Concerns/ParallelCommand.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Concerns/ParallelCommand.php b/src/Concerns/ParallelCommand.php index c92ddf70..27981cf3 100644 --- a/src/Concerns/ParallelCommand.php +++ b/src/Concerns/ParallelCommand.php @@ -26,7 +26,7 @@ trait ParallelCommand if ($pid === -1) { return -1; - } else if ($pid) { + } elseif ($pid) { // Parent return $pid; } else { @@ -42,12 +42,12 @@ trait ParallelCommand $processes = (int) $this->input->getOption('processes'); if (($processes < 0) || ($processes > static::MAX_PROCESSES)) { - $this->components->error("Maximum value for processes is " . static::MAX_PROCESSES); + $this->components->error('Maximum value for processes is ' . static::MAX_PROCESSES); exit(1); } if ($processes > 1 && ! function_exists('pcntl_fork')) { - $this->components->error("The pcntl extension is required for parallel migrations to work."); + $this->components->error('The pcntl extension is required for parallel migrations to work.'); } return $processes; @@ -57,10 +57,11 @@ trait ParallelCommand { $idCol = tenancy()->model()->getTenantKeyName(); $tenants = tenancy()->model()->orderBy($idCol, 'asc')->pluck($idCol); + return $tenants->chunk(ceil($tenants->count() / $this->getProcesses())); } - protected function runConcurrently(array|ArrayAccess $args = null): int + protected function runConcurrently(array|ArrayAccess|null $args = null): int { $processes = $this->getProcesses(); $success = true;