Skip to content

Commit

Permalink
add return type hints (#1351)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brettmc authored Jul 19, 2024
1 parent e4f9604 commit 1271f1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
12 changes: 3 additions & 9 deletions src/SDK/Common/Attribute/AttributesBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]);
}
Expand Down
9 changes: 3 additions & 6 deletions src/SDK/Common/Attribute/FilteredAttributesBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,15 @@ public function offsetExists($offset): bool
/**
* @phan-suppress PhanUndeclaredClassAttribute
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
public function offsetGet(mixed $offset): mixed
{
return $this->builder->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++;
Expand All @@ -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);
}
Expand Down

0 comments on commit 1271f1e

Please sign in to comment.