Skip to content

Commit

Permalink
Merge pull request #247 from neildaniels/php8.1-type-hints
Browse files Browse the repository at this point in the history
Add PHP 8.1 type hints for ArrayAccess, IteratorAggregate, and Countable
  • Loading branch information
wtfzdotnet authored Dec 11, 2021
2 parents 89a3c9a + 92dada6 commit 0349e2c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/Tmdb/Model/Common/GenericCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ public function __construct(array $data = [])
/**
* @return int
*/
public function count()
public function count(): int
{
return count($this->data);
}

/**
* @return ArrayIterator|Traversable
*/
public function getIterator()
public function getIterator(): Traversable
{
return new ArrayIterator($this->data);
}
Expand Down Expand Up @@ -288,22 +288,23 @@ public function sort(Closure $closure)
return $this;
}

public function offsetExists($offset)
public function offsetExists($offset): bool
{
return isset($this->data[$offset]);
}

#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return isset($this->data[$offset]) ? $this->data[$offset] : null;
}

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]);
}
Expand Down

0 comments on commit 0349e2c

Please sign in to comment.