Skip to content

Commit

Permalink
Merge pull request #103 from myworkout/main
Browse files Browse the repository at this point in the history
Improve PHP 8.1.0 support
  • Loading branch information
freekmurze authored Dec 1, 2021
2 parents bf015b2 + ee5bf2c commit 26ace80
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/IterableImplementation.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ trait IterableImplementation
{
protected $position = 0;

public function offsetGet($offset)
public function offsetGet(mixed $offset): mixed
{
return $this->periods[$offset] ?? null;
}

public function offsetSet($offset, $value)
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->periods[] = $value;
Expand All @@ -22,32 +22,32 @@ public function offsetSet($offset, $value)
$this->periods[$offset] = $value;
}

public function offsetExists($offset)
public function offsetExists(mixed $offset): bool
{
return array_key_exists($offset, $this->periods);
}

public function offsetUnset($offset)
public function offsetUnset(mixed $offset): void
{
unset($this->periods[$offset]);
}

public function next()
public function next(): void
{
$this->position++;
}

public function key()
public function key(): mixed
{
return $this->position;
}

public function valid()
public function valid(): bool
{
return array_key_exists($this->position, $this->periods);
}

public function rewind()
public function rewind(): void
{
$this->position = 0;
}
Expand Down

0 comments on commit 26ace80

Please sign in to comment.