From 02d76eee9afbea2cb6b46d6da9b912157d6b8b36 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Wed, 9 Oct 2024 20:58:21 +0800 Subject: [PATCH] [5.x] Use `#[\Override]` PHP Attribute to detect breaking changes (#1506) Signed-off-by: Mior Muhammad Zaki --- composer.json | 5 +++-- src/RedisQueue.php | 9 +++++++++ src/SupervisorProcess.php | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 6970246a..ee13ee12 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,9 @@ "nesbot/carbon": "^2.17|^3.0", "ramsey/uuid": "^4.0", "symfony/console": "^6.0|^7.0", - "symfony/process": "^6.0|^7.0", - "symfony/error-handler": "^6.0|^7.0" + "symfony/error-handler": "^6.0|^7.0", + "symfony/polyfill-php83": "^1.28", + "symfony/process": "^6.0|^7.0" }, "require-dev": { "mockery/mockery": "^1.0", diff --git a/src/RedisQueue.php b/src/RedisQueue.php index f4df046d..ff045153 100644 --- a/src/RedisQueue.php +++ b/src/RedisQueue.php @@ -39,6 +39,7 @@ public function readyNow($queue = null) * @param string|null $queue * @return mixed */ + #[\Override] public function push($job, $data = '', $queue = null) { return $this->enqueueUsing( @@ -62,6 +63,7 @@ function ($payload, $queue) use ($job) { * @param array $options * @return mixed */ + #[\Override] public function pushRaw($payload, $queue = null, array $options = []) { $payload = (new JobPayload($payload))->prepare($this->lastPushed); @@ -81,6 +83,7 @@ public function pushRaw($payload, $queue = null, array $options = []) * @param mixed $data * @return array */ + #[\Override] protected function createPayloadArray($job, $queue, $data = '') { $payload = parent::createPayloadArray($job, $queue, $data); @@ -99,6 +102,7 @@ protected function createPayloadArray($job, $queue, $data = '') * @param string $queue * @return mixed */ + #[\Override] public function later($delay, $job, $data = '', $queue = null) { $payload = (new JobPayload($this->createPayload($job, $queue, $data)))->prepare($job)->value; @@ -126,8 +130,10 @@ function ($payload, $queue, $delay) { * Pop the next job off of the queue. * * @param string $queue + * @param int $index * @return \Illuminate\Contracts\Queue\Job|null */ + #[\Override] public function pop($queue = null, $index = 0) { return tap(parent::pop($queue, $index), function ($result) use ($queue) { @@ -144,6 +150,7 @@ public function pop($queue = null, $index = 0) * @param string $to * @return void */ + #[\Override] public function migrateExpiredJobs($from, $to) { return tap(parent::migrateExpiredJobs($from, $to), function ($jobs) use ($to) { @@ -158,6 +165,7 @@ public function migrateExpiredJobs($from, $to) * @param \Illuminate\Queue\Jobs\RedisJob $job * @return void */ + #[\Override] public function deleteReserved($queue, $job) { parent::deleteReserved($queue, $job); @@ -173,6 +181,7 @@ public function deleteReserved($queue, $job) * @param int $delay * @return void */ + #[\Override] public function deleteAndRelease($queue, $job, $delay) { parent::deleteAndRelease($queue, $job, $delay); diff --git a/src/SupervisorProcess.php b/src/SupervisorProcess.php index 8230100d..48d9d330 100644 --- a/src/SupervisorProcess.php +++ b/src/SupervisorProcess.php @@ -67,6 +67,7 @@ public function __construct(SupervisorOptions $options, $process, Closure $outpu * * @return void */ + #[\Override] public function monitor() { if (! $this->process->isStarted()) {