From 2b197392eb3a8209e6fafb748d9c4ad6c7ddf351 Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 19 Dec 2023 09:33:27 +0100 Subject: [PATCH 1/2] fix type casting --- src/Commands/QueueWork.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Commands/QueueWork.php b/src/Commands/QueueWork.php index ec46eae..1b45902 100644 --- a/src/Commands/QueueWork.php +++ b/src/Commands/QueueWork.php @@ -161,7 +161,7 @@ public function run(array $params) CLI::print('Starting a new job: ', 'cyan'); CLI::print($work->payload['job'], 'light_cyan'); CLI::print(', with ID: ', 'cyan'); - CLI::print($work->id, 'light_cyan'); + CLI::print((string) $work->id, 'light_cyan'); $this->handleWork($work, $config, $tries, $retryAfter); From 4378c4d020762023c99c953fd3ef54e712016fc1 Mon Sep 17 00:00:00 2001 From: michalsn Date: Tue, 19 Dec 2023 10:14:33 +0100 Subject: [PATCH 2/2] more casting fixes in commands --- src/Commands/QueueFlush.php | 4 ++++ src/Commands/QueueForget.php | 2 +- src/Commands/QueueRetry.php | 4 +--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Commands/QueueFlush.php b/src/Commands/QueueFlush.php index 47e85c8..8bd8e06 100644 --- a/src/Commands/QueueFlush.php +++ b/src/Commands/QueueFlush.php @@ -56,6 +56,10 @@ public function run(array $params) $hours = $params['hours'] ?? CLI::getOption('hours'); $queue = $params['queue'] ?? CLI::getOption('queue'); + if ($hours !== null) { + $hours = (int) $hours; + } + service('queue')->flush($hours, $queue); if ($hours === null) { diff --git a/src/Commands/QueueForget.php b/src/Commands/QueueForget.php index f5ebdab..b99088d 100644 --- a/src/Commands/QueueForget.php +++ b/src/Commands/QueueForget.php @@ -59,7 +59,7 @@ public function run(array $params) return EXIT_ERROR; } - if (service('queue')->forget($id)) { + if (service('queue')->forget((int) $id)) { CLI::write(sprintf('Failed job with ID %s has been removed.', $id), 'green'); } else { CLI::write(sprintf('Could not find the failed job with ID %s', $id), 'red'); diff --git a/src/Commands/QueueRetry.php b/src/Commands/QueueRetry.php index 88eed8d..f1af6b0 100644 --- a/src/Commands/QueueRetry.php +++ b/src/Commands/QueueRetry.php @@ -68,9 +68,7 @@ public function run(array $params) return EXIT_ERROR; } - if ($id === 'all') { - $id = null; - } + $id = $id === 'all' ? null : (int) $id; $queue = $params['queue'] ?? CLI::getOption('queue');