diff --git a/src/FieldType/DBMultiResource.php b/src/FieldType/DBMultiResource.php index bcc8127..27e642c 100644 --- a/src/FieldType/DBMultiResource.php +++ b/src/FieldType/DBMultiResource.php @@ -9,6 +9,7 @@ use Exception; use SilverStripe\ORM\Limitable; use SilverStripe\ORM\Map; +use Traversable; abstract class DBMultiResource extends DBBaseResource implements ArrayAccess, Countable, IteratorAggregate, Limitable { @@ -60,7 +61,7 @@ public function setValue($value, $record = null, $markChanged = true) /** * @return ArrayIterator */ - public function getIterator() + public function getIterator(): Traversable { return new ArrayIterator($this->items); } @@ -69,7 +70,7 @@ public function getIterator() * @param int $offset * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return array_key_exists($offset, $this->items); } @@ -78,7 +79,7 @@ public function offsetExists($offset) * @param int $offset * @return DBSingleResource|null */ - public function offsetGet($offset) + public function offsetGet($offset): mixed { if ($this->offsetExists($offset)) { return $this->items[$offset]; @@ -90,34 +91,28 @@ public function offsetGet($offset) /** * @param int $offset * @param DBSingleResource $value - * @return $this */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if ($offset == null) { $this->items[] = $value; } else { $this->items[$offset] = $value; } - - return $this; } /** * @param int $offset - * @return $this */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->items[$offset]); - - return $this; } /** * @return int */ - public function count() + public function count(): int { return count($this->items); }