mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 14:05:29 +02:00
Merge pull request #338 from creative-commoners/pulls/4/ReturnTypeWillChange
API Strongly type iterator classes and remove ReturnTypeWillChange annotation
This commit is contained in:
commit
d73868f8c0
@ -32,29 +32,26 @@ class CombinationsArrayIterator implements Iterator
|
||||
$this->rewind();
|
||||
}
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
public function rewind()
|
||||
public function rewind(): void
|
||||
{
|
||||
if (!$this->numArrays) {
|
||||
$this->isValid = false;
|
||||
} else {
|
||||
$this->isValid = true;
|
||||
$this->k = 0;
|
||||
|
||||
|
||||
for ($i = 0; $i < $this->numArrays; $i++) {
|
||||
reset($this->arrays[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[\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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user