Skip to content

Commit

Permalink
Add support for PHP 8.1 (#83)
Browse files Browse the repository at this point in the history
* Add support PHP 8.1
  • Loading branch information
annuh authored Nov 17, 2021
1 parent 795b20e commit 981489d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/ComplexTypes/BaseArrayOfType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use ArrayIterator;
use ArrayAccess;
use Exception;
use Traversable;

abstract class BaseArrayOfType extends BaseType implements IteratorAggregate, ArrayAccess
{
Expand All @@ -15,27 +16,27 @@ abstract class BaseArrayOfType extends BaseType implements IteratorAggregate, Ar
*/
const WRAPPED_PROPERTY = '';

public function getIterator()
public function getIterator(): Traversable
{
return new ArrayIterator($this->getWrappedProperty());
}

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

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

public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
throw new Exception('Writing to ArrayOf types using ArrayAccess not supported.');
}

public function offsetUnset($offset)
public function offsetUnset($offset): void
{
throw new Exception('Writing to ArrayOf types using ArrayAccess not supported.');
}
Expand Down

0 comments on commit 981489d

Please sign in to comment.