Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP 8.1 type hints for ArrayAccess, IteratorAggregate, and Countable #247

Merged
merged 4 commits into from
Dec 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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