Skip to content

Commit 0349e2c

Browse files
authored
Merge pull request #247 from neildaniels/php8.1-type-hints
Add PHP 8.1 type hints for ArrayAccess, IteratorAggregate, and Countable
2 parents 89a3c9a + 92dada6 commit 0349e2c

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

lib/Tmdb/Model/Common/GenericCollection.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ public function __construct(array $data = [])
4848
/**
4949
* @return int
5050
*/
51-
public function count()
51+
public function count(): int
5252
{
5353
return count($this->data);
5454
}
5555

5656
/**
5757
* @return ArrayIterator|Traversable
5858
*/
59-
public function getIterator()
59+
public function getIterator(): Traversable
6060
{
6161
return new ArrayIterator($this->data);
6262
}
@@ -288,22 +288,23 @@ public function sort(Closure $closure)
288288
return $this;
289289
}
290290

291-
public function offsetExists($offset)
291+
public function offsetExists($offset): bool
292292
{
293293
return isset($this->data[$offset]);
294294
}
295295

296+
#[\ReturnTypeWillChange]
296297
public function offsetGet($offset)
297298
{
298299
return isset($this->data[$offset]) ? $this->data[$offset] : null;
299300
}
300301

301-
public function offsetSet($offset, $value)
302+
public function offsetSet($offset, $value): void
302303
{
303304
$this->data[$offset] = $value;
304305
}
305306

306-
public function offsetUnset($offset)
307+
public function offsetUnset($offset): void
307308
{
308309
unset($this->data[$offset]);
309310
}

0 commit comments

Comments
 (0)