From 25520e468b4d935fd1c55f448f1b649bcb13b4d1 Mon Sep 17 00:00:00 2001 From: Luke Kuzmish Date: Sat, 22 Nov 2025 07:00:27 -0500 Subject: [PATCH 1/6] employ trait --- .../Queue/Console/Concerns/ParsesQueue.php | 21 +++++++++++++++++++ .../Queue/Console/ContinueCommand.php | 18 +++------------- src/Illuminate/Queue/Console/PauseCommand.php | 20 ++++-------------- .../Queue/Console/ResumeCommand.php | 18 +++------------- 4 files changed, 31 insertions(+), 46 deletions(-) create mode 100644 src/Illuminate/Queue/Console/Concerns/ParsesQueue.php diff --git a/src/Illuminate/Queue/Console/Concerns/ParsesQueue.php b/src/Illuminate/Queue/Console/Concerns/ParsesQueue.php new file mode 100644 index 000000000000..31769859a2f8 --- /dev/null +++ b/src/Illuminate/Queue/Console/Concerns/ParsesQueue.php @@ -0,0 +1,21 @@ +laravel['config']['queue.default'], $connection]; + } +} diff --git a/src/Illuminate/Queue/Console/ContinueCommand.php b/src/Illuminate/Queue/Console/ContinueCommand.php index 78c5f709fa6b..14a34ccd7c58 100644 --- a/src/Illuminate/Queue/Console/ContinueCommand.php +++ b/src/Illuminate/Queue/Console/ContinueCommand.php @@ -4,11 +4,14 @@ use Illuminate\Console\Command; use Illuminate\Contracts\Queue\Factory as QueueManager; +use Illuminate\Queue\Console\Concerns\ParsesQueue; use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand(name: 'queue:continue')] class ContinueCommand extends Command { + use ParsesQueue; + /** * The console command name. * @@ -55,19 +58,4 @@ public function handle() return 0; } - - /** - * Parse the queue argument into connection and queue name. - * - * @param string $queue - * @return array - */ - protected function parseQueue($queue) - { - [$connection, $queue] = array_pad(explode(':', $queue, 2), 2, null); - - return isset($queue) - ? [$connection, $queue] - : [$this->laravel['config']['queue.default'], $connection]; - } } diff --git a/src/Illuminate/Queue/Console/PauseCommand.php b/src/Illuminate/Queue/Console/PauseCommand.php index 6997835ce611..4b19b94ffe4f 100644 --- a/src/Illuminate/Queue/Console/PauseCommand.php +++ b/src/Illuminate/Queue/Console/PauseCommand.php @@ -4,11 +4,14 @@ use Illuminate\Console\Command; use Illuminate\Contracts\Queue\Factory as QueueManager; +use Illuminate\Queue\Console\Concerns\ParsesQueue; use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand(name: 'queue:pause')] class PauseCommand extends Command { + use ParsesQueue; + /** * The console command name. * @@ -45,7 +48,7 @@ public function __construct(QueueManager $manager) * * @return int */ - public function handle() + public function handle(QueueManager $manager) { [$connection, $queue] = $this->parseQueue($this->argument('queue')); @@ -55,19 +58,4 @@ public function handle() return 0; } - - /** - * Parse the queue argument into the connection and queue name. - * - * @param string $queue - * @return array - */ - protected function parseQueue($queue) - { - [$connection, $queue] = array_pad(explode(':', $queue, 2), 2, null); - - return isset($queue) - ? [$connection, $queue] - : [$this->laravel['config']['queue.default'], $connection]; - } } diff --git a/src/Illuminate/Queue/Console/ResumeCommand.php b/src/Illuminate/Queue/Console/ResumeCommand.php index a6c4d478a558..0667f5ac3e21 100644 --- a/src/Illuminate/Queue/Console/ResumeCommand.php +++ b/src/Illuminate/Queue/Console/ResumeCommand.php @@ -4,11 +4,14 @@ use Illuminate\Console\Command; use Illuminate\Contracts\Queue\Factory as QueueManager; +use Illuminate\Queue\Console\Concerns\ParsesQueue; use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand(name: 'queue:resume')] class ResumeCommand extends Command { + use ParsesQueue; + /** * The console command name. * @@ -55,19 +58,4 @@ public function handle() return 0; } - - /** - * Parse the queue argument into connection and queue name. - * - * @param string $queue - * @return array - */ - protected function parseQueue($queue) - { - [$connection, $queue] = array_pad(explode(':', $queue, 2), 2, null); - - return isset($queue) - ? [$connection, $queue] - : [$this->laravel['config']['queue.default'], $connection]; - } } From c73dd44cdbdcf1ecdbb76e9ad938a2702e5e45dd Mon Sep 17 00:00:00 2001 From: Luke Kuzmish Date: Sat, 22 Nov 2025 07:03:58 -0500 Subject: [PATCH 2/6] employ trait --- .../Queue/Console/ContinueCommand.php | 21 ++----------------- src/Illuminate/Queue/Console/PauseCommand.php | 19 +---------------- .../Queue/Console/ResumeCommand.php | 21 ++----------------- 3 files changed, 5 insertions(+), 56 deletions(-) diff --git a/src/Illuminate/Queue/Console/ContinueCommand.php b/src/Illuminate/Queue/Console/ContinueCommand.php index 14a34ccd7c58..bf59802edd96 100644 --- a/src/Illuminate/Queue/Console/ContinueCommand.php +++ b/src/Illuminate/Queue/Console/ContinueCommand.php @@ -26,33 +26,16 @@ class ContinueCommand extends Command */ protected $description = 'Resume job processing for a paused queue'; - /** - * The queue manager instance. - * - * @var \Illuminate\Contracts\Queue\Factory - */ - protected $manager; - - /** - * Create a new queue resume command. - */ - public function __construct(QueueManager $manager) - { - parent::__construct(); - - $this->manager = $manager; - } - /** * Execute the console command. * * @return int */ - public function handle() + public function handle(QueueManager $manager) { [$connection, $queue] = $this->parseQueue($this->argument('queue')); - $this->manager->resume($connection, $queue); + $manager->resume($connection, $queue); $this->components->info("Job processing on queue [{$connection}:{$queue}] has been resumed."); diff --git a/src/Illuminate/Queue/Console/PauseCommand.php b/src/Illuminate/Queue/Console/PauseCommand.php index 4b19b94ffe4f..8b18c23ee621 100644 --- a/src/Illuminate/Queue/Console/PauseCommand.php +++ b/src/Illuminate/Queue/Console/PauseCommand.php @@ -26,23 +26,6 @@ class PauseCommand extends Command */ protected $description = 'Pause job processing for a specific queue'; - /** - * The queue manager instance. - * - * @var \Illuminate\Contracts\Queue\Factory - */ - protected $manager; - - /** - * Create a new queue pause command. - */ - public function __construct(QueueManager $manager) - { - parent::__construct(); - - $this->manager = $manager; - } - /** * Execute the console command. * @@ -52,7 +35,7 @@ public function handle(QueueManager $manager) { [$connection, $queue] = $this->parseQueue($this->argument('queue')); - $this->manager->pause($connection, $queue); + $manager->pause($connection, $queue); $this->components->info("Job processing on queue [{$connection}:{$queue}] has been paused."); diff --git a/src/Illuminate/Queue/Console/ResumeCommand.php b/src/Illuminate/Queue/Console/ResumeCommand.php index 0667f5ac3e21..7e3c3364ae46 100644 --- a/src/Illuminate/Queue/Console/ResumeCommand.php +++ b/src/Illuminate/Queue/Console/ResumeCommand.php @@ -26,33 +26,16 @@ class ResumeCommand extends Command */ protected $description = 'Resume job processing for a paused queue'; - /** - * The queue manager instance. - * - * @var \Illuminate\Contracts\Queue\Factory - */ - protected $manager; - - /** - * Create a new queue resume command. - */ - public function __construct(QueueManager $manager) - { - parent::__construct(); - - $this->manager = $manager; - } - /** * Execute the console command. * * @return int */ - public function handle() + public function handle(QueueManager $manager) { [$connection, $queue] = $this->parseQueue($this->argument('queue')); - $this->manager->resume($connection, $queue); + $manager->resume($connection, $queue); $this->components->info("Job processing on queue [{$connection}:{$queue}] has been resumed."); From 8eab518fa6bc67ffb0c3c0ade00f25c844e6b11c Mon Sep 17 00:00:00 2001 From: Luke Kuzmish Date: Sat, 22 Nov 2025 07:06:19 -0500 Subject: [PATCH 3/6] typehints --- src/Illuminate/Queue/Console/Concerns/ParsesQueue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Console/Concerns/ParsesQueue.php b/src/Illuminate/Queue/Console/Concerns/ParsesQueue.php index 31769859a2f8..6842cec58e0c 100644 --- a/src/Illuminate/Queue/Console/Concerns/ParsesQueue.php +++ b/src/Illuminate/Queue/Console/Concerns/ParsesQueue.php @@ -8,7 +8,7 @@ trait ParsesQueue * Parse the queue argument into connection and queue name. * * @param string $queue - * @return array + * @return array{string, string} */ protected function parseQueue($queue) { From f6aeb2a9c25a40bc7318a2c4946df39f4fa44f2e Mon Sep 17 00:00:00 2001 From: Luke Kuzmish Date: Sat, 22 Nov 2025 07:09:19 -0500 Subject: [PATCH 4/6] use alias --- .../Queue/Console/ContinueCommand.php | 44 ------------------- .../Queue/Console/ResumeCommand.php | 9 +++- 2 files changed, 8 insertions(+), 45 deletions(-) delete mode 100644 src/Illuminate/Queue/Console/ContinueCommand.php diff --git a/src/Illuminate/Queue/Console/ContinueCommand.php b/src/Illuminate/Queue/Console/ContinueCommand.php deleted file mode 100644 index bf59802edd96..000000000000 --- a/src/Illuminate/Queue/Console/ContinueCommand.php +++ /dev/null @@ -1,44 +0,0 @@ -parseQueue($this->argument('queue')); - - $manager->resume($connection, $queue); - - $this->components->info("Job processing on queue [{$connection}:{$queue}] has been resumed."); - - return 0; - } -} diff --git a/src/Illuminate/Queue/Console/ResumeCommand.php b/src/Illuminate/Queue/Console/ResumeCommand.php index 7e3c3364ae46..052d7f51d3d1 100644 --- a/src/Illuminate/Queue/Console/ResumeCommand.php +++ b/src/Illuminate/Queue/Console/ResumeCommand.php @@ -7,7 +7,7 @@ use Illuminate\Queue\Console\Concerns\ParsesQueue; use Symfony\Component\Console\Attribute\AsCommand; -#[AsCommand(name: 'queue:resume')] +#[AsCommand(name: 'queue:resume', aliases: ['queue:continue'])] class ResumeCommand extends Command { use ParsesQueue; @@ -19,6 +19,13 @@ class ResumeCommand extends Command */ protected $signature = 'queue:resume {queue : The name of the queue that should resume processing}'; + /** + * The console command name aliases. + * + * @var array + */ + protected $aliases = ['queue:continue']; + /** * The console command description. * From 466fff65c59f662b4ac78abe579dd4fc084b8415 Mon Sep 17 00:00:00 2001 From: Luke Kuzmish Date: Sat, 22 Nov 2025 07:11:01 -0500 Subject: [PATCH 5/6] remove reference --- src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php b/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php index 020094c2b0ce..891678003d2b 100755 --- a/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php +++ b/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php @@ -91,7 +91,6 @@ use Illuminate\Notifications\Console\NotificationTableCommand; use Illuminate\Queue\Console\BatchesTableCommand; use Illuminate\Queue\Console\ClearCommand as QueueClearCommand; -use Illuminate\Queue\Console\ContinueCommand as QueueContinueCommand; use Illuminate\Queue\Console\FailedTableCommand; use Illuminate\Queue\Console\FlushFailedCommand as FlushFailedQueueCommand; use Illuminate\Queue\Console\ForgetFailedCommand as ForgetFailedQueueCommand; @@ -148,7 +147,6 @@ class ArtisanServiceProvider extends ServiceProvider implements DeferrableProvid 'PackageDiscover' => PackageDiscoverCommand::class, 'PruneStaleTagsCommand' => PruneStaleTagsCommand::class, 'QueueClear' => QueueClearCommand::class, - 'QueueContinue' => QueueContinueCommand::class, 'QueueFailed' => ListFailedQueueCommand::class, 'QueueFlush' => FlushFailedQueueCommand::class, 'QueueForget' => ForgetFailedQueueCommand::class, From aa1866beee0cea3f4072d1cf25fe539a9c3ebaea Mon Sep 17 00:00:00 2001 From: Luke Kuzmish Date: Sat, 22 Nov 2025 07:24:45 -0500 Subject: [PATCH 6/6] typehint --- src/Illuminate/Queue/Console/ResumeCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Console/ResumeCommand.php b/src/Illuminate/Queue/Console/ResumeCommand.php index 052d7f51d3d1..67a0ac69293b 100644 --- a/src/Illuminate/Queue/Console/ResumeCommand.php +++ b/src/Illuminate/Queue/Console/ResumeCommand.php @@ -22,7 +22,7 @@ class ResumeCommand extends Command /** * The console command name aliases. * - * @var array + * @var list */ protected $aliases = ['queue:continue'];