fix: deprecated Settings should be compatible with \Iterator

This commit is contained in:
norb 2024-11-11 16:26:22 +01:00
commit aaf4321f56

View file

@ -270,7 +270,7 @@ class Settings implements \Iterator, \Countable
* Rewind the Iterator to the first element * Rewind the Iterator to the first element
* @link https://www.php.net/iterator.rewind * @link https://www.php.net/iterator.rewind
*/ */
public function rewind() public function rewind(): void
{ {
reset( $this->settings); reset( $this->settings);
} }
@ -279,7 +279,7 @@ class Settings implements \Iterator, \Countable
* Return the current element * Return the current element
* @link https://www.php.net/iterator.current * @link https://www.php.net/iterator.current
*/ */
public function current() public function current(): mixed
{ {
return current( $this->settings ); return current( $this->settings );
} }
@ -288,7 +288,7 @@ class Settings implements \Iterator, \Countable
* Return the key of the current element * Return the key of the current element
* @link https://www.php.net/iterator.key * @link https://www.php.net/iterator.key
*/ */
public function key() public function key(): mixed
{ {
return key( $this->settings ); return key( $this->settings );
} }
@ -297,16 +297,16 @@ class Settings implements \Iterator, \Countable
* Move forward to next element * Move forward to next element
* @link https://www.php.net/iterator.next * @link https://www.php.net/iterator.next
*/ */
public function next() public function next(): void
{ {
return next( $this->settings ); next( $this->settings );
} }
/** /**
* Checks if current position is valid * Checks if current position is valid
* @link https://www.php.net/iterator.valid * @link https://www.php.net/iterator.valid
*/ */
public function valid() public function valid(): bool
{ {
$key = key( $this->settings ); $key = key( $this->settings );
return ($key !== null && $key !== false); return ($key !== null && $key !== false);