From 1271f1ed69c72da60aefaeabaee8dde2498eac48 Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Fri, 19 Jul 2024 23:33:49 +1000 Subject: [PATCH] add return type hints (#1351) now that 7.4 and 8.0 support is dropped, we can add correct return type-hints to these functions, and remove the ReturnTypeWillChange attribute. --- src/SDK/Common/Attribute/AttributesBuilder.php | 12 +++--------- .../Common/Attribute/FilteredAttributesBuilder.php | 9 +++------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/SDK/Common/Attribute/AttributesBuilder.php b/src/SDK/Common/Attribute/AttributesBuilder.php index 59973e629..a81c1042c 100644 --- a/src/SDK/Common/Attribute/AttributesBuilder.php +++ b/src/SDK/Common/Attribute/AttributesBuilder.php @@ -49,20 +49,16 @@ public function offsetExists($offset): bool /** * @phan-suppress PhanUndeclaredClassAttribute - * @return mixed */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet($offset): mixed { return $this->attributes[$offset] ?? null; } /** * @phan-suppress PhanUndeclaredClassAttribute - * @return void */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if ($offset === null) { return; @@ -92,10 +88,8 @@ public function offsetSet($offset, $value) /** * @phan-suppress PhanUndeclaredClassAttribute - * @return void */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->attributes[$offset]); } diff --git a/src/SDK/Common/Attribute/FilteredAttributesBuilder.php b/src/SDK/Common/Attribute/FilteredAttributesBuilder.php index 3162ac5dd..8d7c9c10e 100644 --- a/src/SDK/Common/Attribute/FilteredAttributesBuilder.php +++ b/src/SDK/Common/Attribute/FilteredAttributesBuilder.php @@ -48,8 +48,7 @@ public function offsetExists($offset): bool /** * @phan-suppress PhanUndeclaredClassAttribute */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset): mixed { return $this->builder->offsetGet($offset); } @@ -57,8 +56,7 @@ public function offsetGet($offset) /** * @phan-suppress PhanUndeclaredClassAttribute */ - #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if ($value !== null && in_array($offset, $this->rejectedKeys, true)) { $this->rejected++; @@ -72,8 +70,7 @@ public function offsetSet($offset, $value) /** * @phan-suppress PhanUndeclaredClassAttribute */ - #[\ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { $this->builder->offsetUnset($offset); }