From a315e6039825bd27989dce559abfaf18f198ac02 Mon Sep 17 00:00:00 2001 From: Stephen Reay Date: Tue, 24 Feb 2026 22:37:15 +0700 Subject: [PATCH 1/2] Fix hierarchy warnings for >= php8.1 --- src/Jobs/BaseJob.php | 8 ++++---- src/Jobs/Collection.php | 8 ++++---- src/Jobs/JobData.php | 6 +++--- src/Queues/Collection.php | 8 ++++---- src/Workers/Collection.php | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Jobs/BaseJob.php b/src/Jobs/BaseJob.php index 1b4607a..4926bb0 100644 --- a/src/Jobs/BaseJob.php +++ b/src/Jobs/BaseJob.php @@ -539,22 +539,22 @@ public function __toString() return sprintf('%s %s', get_class($this), $this->description); } - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->data[$offset]); } - public function offsetGet($offset) + public function offsetGet($offset): mixed { return $this->data[$offset]; } - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->data[$offset]); } diff --git a/src/Jobs/Collection.php b/src/Jobs/Collection.php index da1a5e2..aac7c76 100644 --- a/src/Jobs/Collection.php +++ b/src/Jobs/Collection.php @@ -177,7 +177,7 @@ public function fromWorker(string $worker, string $subTimeInterval = ''): array * @param string $jid * @return bool */ - public function offsetExists($jid) + public function offsetExists($jid): bool { return $this->client->get($jid) !== null; } @@ -190,7 +190,7 @@ public function offsetExists($jid) * * @throws QlessException */ - public function offsetGet($jid) + public function offsetGet($jid): mixed { $data = $this->client->get($jid); @@ -215,7 +215,7 @@ public function offsetGet($jid) * * @throws UnsupportedFeatureException */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { throw new UnsupportedFeatureException('Setting a job is not supported using Jobs collection.'); } @@ -225,7 +225,7 @@ public function offsetSet($offset, $value) * * @throws UnsupportedFeatureException */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { throw new UnsupportedFeatureException('Deleting a job is not supported using Jobs collection.'); } diff --git a/src/Jobs/JobData.php b/src/Jobs/JobData.php index c84cbf7..f1bf01a 100644 --- a/src/Jobs/JobData.php +++ b/src/Jobs/JobData.php @@ -17,7 +17,7 @@ final class JobData extends ArrayObject implements JsonSerializable * * @return array */ - public function jsonSerialize() + public function jsonSerialize(): array { return $this->toArray(); } @@ -25,9 +25,9 @@ public function jsonSerialize() /** * Creates a copy of the ArrayObject (alias for \ArrayObject::getArrayCopy). * - * @see \ArrayObject::getArrayCopy - * * @return array + * @see ArrayObject::getArrayCopy + * */ public function toArray(): array { diff --git a/src/Queues/Collection.php b/src/Queues/Collection.php index 5d1b5d9..5894176 100644 --- a/src/Queues/Collection.php +++ b/src/Queues/Collection.php @@ -100,7 +100,7 @@ public function fromSubscriptions(string $topic): array * @param mixed $offset * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { $queues = json_decode($this->client->queues(), true) ?: []; @@ -119,7 +119,7 @@ public function offsetExists($offset) * @param string $offset * @return Queue */ - public function offsetGet($offset) + public function offsetGet($offset): Queue { return new Queue($offset, $this->client); } @@ -129,7 +129,7 @@ public function offsetGet($offset) * * @throws UnsupportedFeatureException */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { throw new UnsupportedFeatureException('Setting a queue is not supported using Queues collection.'); } @@ -139,7 +139,7 @@ public function offsetSet($offset, $value) * * @throws QlessException If the queue is not empty. */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { $this[$offset]->forget(); } diff --git a/src/Workers/Collection.php b/src/Workers/Collection.php index 8c65ee6..3b9bf8c 100644 --- a/src/Workers/Collection.php +++ b/src/Workers/Collection.php @@ -72,7 +72,7 @@ public function getRange(int $start, int $last): array * @param mixed $offset * @return bool */ - public function offsetExists($offset) + public function offsetExists($offset): bool { $workers = json_decode($this->client->workers(), true) ?: []; @@ -91,7 +91,7 @@ public function offsetExists($offset) * @param string $offset * @return array */ - public function offsetGet($offset) + public function offsetGet($offset): array { $worker = json_decode($this->client->workers($offset), true) ?: []; @@ -107,7 +107,7 @@ public function offsetGet($offset) * * @throws UnsupportedFeatureException */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { throw new UnsupportedFeatureException('Setting a worker is not supported using Workers collection.'); } @@ -117,7 +117,7 @@ public function offsetSet($offset, $value) * * @throws UnsupportedFeatureException */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { throw new UnsupportedFeatureException('Deleting a worker is not supported using Workers collection.'); } From 557c2a54d8ce1d791a21b5a8c5410d7ea19f751a Mon Sep 17 00:00:00 2001 From: Stephen Reay Date: Wed, 25 Feb 2026 16:21:17 +0700 Subject: [PATCH 2/2] Ensure compatibility back to php7.1 --- src/Jobs/BaseJob.php | 3 ++- src/Jobs/Collection.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Jobs/BaseJob.php b/src/Jobs/BaseJob.php index 4926bb0..661489d 100644 --- a/src/Jobs/BaseJob.php +++ b/src/Jobs/BaseJob.php @@ -544,7 +544,8 @@ public function offsetExists($offset): bool return isset($this->data[$offset]); } - public function offsetGet($offset): mixed + #[\ReturnTypeWillChange] + public function offsetGet($offset) { return $this->data[$offset]; } diff --git a/src/Jobs/Collection.php b/src/Jobs/Collection.php index aac7c76..9739523 100644 --- a/src/Jobs/Collection.php +++ b/src/Jobs/Collection.php @@ -190,7 +190,8 @@ public function offsetExists($jid): bool * * @throws QlessException */ - public function offsetGet($jid): mixed + #[\ReturnTypeWillChange] + public function offsetGet($jid) { $data = $this->client->get($jid);