Merge pull request #338 from creative-commoners/pulls/4/ReturnTypeWillChange

API Strongly type iterator classes and remove ReturnTypeWillChange annotation
This commit is contained in:
Guy Sartorelli 2023-01-24 11:52:38 +13:00 committed by GitHub
commit d73868f8c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 21 deletions

View File

@ -32,8 +32,7 @@ class CombinationsArrayIterator implements Iterator
$this->rewind();
}
#[\ReturnTypeWillChange]
public function rewind()
public function rewind(): void
{
if (!$this->numArrays) {
$this->isValid = false;
@ -47,14 +46,12 @@ class CombinationsArrayIterator implements Iterator
}
}
#[\ReturnTypeWillChange]
public function valid()
public function valid(): bool
{
return $this->isValid;
}
#[\ReturnTypeWillChange]
public function next()
public function next(): void
{
$this->k++;
@ -71,8 +68,7 @@ class CombinationsArrayIterator implements Iterator
}
}
#[\ReturnTypeWillChange]
public function current()
public function current(): mixed
{
$res = array();
for ($i = 0; $i < $this->numArrays; $i++) {
@ -81,8 +77,7 @@ class CombinationsArrayIterator implements Iterator
return $res;
}
#[\ReturnTypeWillChange]
public function key()
public function key(): mixed
{
return $this->k;
}

View File

@ -22,8 +22,7 @@ class MultipleArrayIterator implements Iterator
$this->rewind();
}
#[\ReturnTypeWillChange]
public function rewind()
public function rewind(): void
{
$this->active = $this->arrays;
if ($this->active) {
@ -31,20 +30,17 @@ class MultipleArrayIterator implements Iterator
}
}
#[\ReturnTypeWillChange]
public function current()
public function current(): mixed
{
return $this->active ? current($this->active[0]) : false;
}
#[\ReturnTypeWillChange]
public function key()
public function key(): mixed
{
return $this->active ? key($this->active[0]) : false;
}
#[\ReturnTypeWillChange]
public function next()
public function next(): void
{
if (!$this->active) {
return;
@ -58,8 +54,7 @@ class MultipleArrayIterator implements Iterator
}
}
#[\ReturnTypeWillChange]
public function valid()
public function valid(): bool
{
return $this->active && (current($this->active[0] ?? []) !== false);
}