From b326e9f356df1c0c100482daf9579fc4eb14c8d9 Mon Sep 17 00:00:00 2001 From: Yemil Godinez Date: Wed, 15 May 2024 08:57:01 +0200 Subject: [PATCH] add missing return types hints && tag it --- src/Iterators.php | 6 +++--- src/Iterators/Combinations.php | 4 ++-- src/Iterators/Cycle.php | 4 ++-- src/Iterators/Fibonacci.php | 6 +++--- src/Iterators/FiniteGroup.php | 8 ++++---- src/Iterators/NGrams.php | 6 +++--- src/Iterators/Perfect.php | 10 +++++----- src/Iterators/Prime.php | 10 +++++----- src/Iterators/PrimeFactors.php | 8 ++++---- src/Iterators/Product.php | 6 +++--- src/Iterators/Rotation.php | 6 +++--- src/Iterators/Shift.php | 6 +++--- 12 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/Iterators.php b/src/Iterators.php index 5e70867..6f394b8 100644 --- a/src/Iterators.php +++ b/src/Iterators.php @@ -23,7 +23,7 @@ abstract class Iterators extends Combinatorics implements Countable, IteratorInt /** * {@inheritdoc} */ - public function current() + public function current(): mixed { return $this->current; } @@ -31,7 +31,7 @@ public function current() /** * {@inheritdoc} */ - public function key() + public function key(): int { return $this->key; } @@ -41,7 +41,7 @@ public function key() * * @return void */ - public function rewind() + public function rewind(): void { $this->key = 0; } diff --git a/src/Iterators/Combinations.php b/src/Iterators/Combinations.php index 4bd9278..fd195e2 100644 --- a/src/Iterators/Combinations.php +++ b/src/Iterators/Combinations.php @@ -46,7 +46,7 @@ public function count(): int /** * {@inheritdoc} */ - public function current() + public function current(): mixed { $r = []; @@ -74,7 +74,7 @@ public function next(): void /** * {@inheritdoc} */ - public function rewind() + public function rewind(): void { $this->c = range(0, $this->length); $this->key = 0; diff --git a/src/Iterators/Cycle.php b/src/Iterators/Cycle.php index 49ead06..3ffadfc 100644 --- a/src/Iterators/Cycle.php +++ b/src/Iterators/Cycle.php @@ -21,7 +21,7 @@ public function count(): int /** * {@inheritdoc} */ - public function current() + public function current(): mixed { return $this->dataset[$this->key]; } @@ -39,7 +39,7 @@ public function next() /** * {@inheritdoc} */ - public function rewind() + public function rewind(): void { $this->key = 0; } diff --git a/src/Iterators/Fibonacci.php b/src/Iterators/Fibonacci.php index 6e30f2e..4577aff 100644 --- a/src/Iterators/Fibonacci.php +++ b/src/Iterators/Fibonacci.php @@ -54,7 +54,7 @@ public function getMaxLimit(): int * * @return void */ - public function next() + public function next(): void { [$this->current, $this->previous] = [$this->current + $this->previous, $this->current]; ++$this->key; @@ -63,7 +63,7 @@ public function next() /** * {@inheritdoc} */ - public function rewind() + public function rewind(): void { $this->previous = 1; $this->current = 0; @@ -78,7 +78,7 @@ public function rewind() * * @return void */ - public function setMaxLimit($max) + public function setMaxLimit($max): void { $this->max = $max; } diff --git a/src/Iterators/FiniteGroup.php b/src/Iterators/FiniteGroup.php index 6c2e6c2..7c62ce2 100644 --- a/src/Iterators/FiniteGroup.php +++ b/src/Iterators/FiniteGroup.php @@ -43,7 +43,7 @@ public function count(): int /** * {@inheritdoc} */ - public function current() + public function current(): mixed { return current($this->group); } @@ -64,7 +64,7 @@ public function getSize(): int * * @return void */ - public function next() + public function next(): void { ++$this->key; next($this->group); @@ -99,7 +99,7 @@ public function order($generator): int * * @return void */ - public function setSize($size) + public function setSize($size): void { $this->size = $size; $this->computeGroup(); @@ -120,7 +120,7 @@ public function valid(): bool * * @return void */ - private function computeGroup() + private function computeGroup(): void { $this->group = []; diff --git a/src/Iterators/NGrams.php b/src/Iterators/NGrams.php index c39f9e2..3647543 100644 --- a/src/Iterators/NGrams.php +++ b/src/Iterators/NGrams.php @@ -35,7 +35,7 @@ public function __construct(array $dataset = [], $length = 1) /** * {@inheritdoc} */ - public function current() + public function current(): mixed { return $this->currentValue; } @@ -45,7 +45,7 @@ public function current() * * @return void */ - public function next() + public function next(): void { parent::next(); $this->currentValue = array_slice($this->current, 0, $this->getLength()); @@ -56,7 +56,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { parent::rewind(); $this->currentValue = array_slice($this->current, 0, $this->getLength()); diff --git a/src/Iterators/Perfect.php b/src/Iterators/Perfect.php index 25308be..7e21043 100644 --- a/src/Iterators/Perfect.php +++ b/src/Iterators/Perfect.php @@ -37,7 +37,7 @@ public function __construct() /** * {@inheritdoc} */ - public function current() + public function current(): mixed { for ($i = $this->key(); $this->getMaxLimit() > $i; ++$i) { if ($this->isPerfectNumber($i)) { @@ -77,7 +77,7 @@ public function getMinLimit(): int * * @return void */ - public function next() + public function next(): void { ++$this->key; } @@ -85,7 +85,7 @@ public function next() /** * {@inheritdoc} */ - public function rewind() + public function rewind(): void { $this->key = $this->getMinLimit(); } @@ -98,7 +98,7 @@ public function rewind() * * @return void */ - public function setMaxLimit($max) + public function setMaxLimit($max): void { $this->max = $max; } @@ -111,7 +111,7 @@ public function setMaxLimit($max) * * @return void */ - public function setMinLimit($min) + public function setMinLimit($min): void { $this->min = $min; } diff --git a/src/Iterators/Prime.php b/src/Iterators/Prime.php index e3ac4d9..916de47 100644 --- a/src/Iterators/Prime.php +++ b/src/Iterators/Prime.php @@ -37,7 +37,7 @@ public function __construct() /** * {@inheritdoc} */ - public function current() + public function current(): mixed { for ($i = $this->key(); $this->getMaxLimit() > $i; ++$i) { if ($this->isPrimeNumber($i)) { @@ -77,7 +77,7 @@ public function getMinLimit(): int * * @return void */ - public function next() + public function next(): void { ++$this->key; } @@ -85,7 +85,7 @@ public function next() /** * {@inheritdoc} */ - public function rewind() + public function rewind(): void { $this->key = $this->getMinLimit(); } @@ -98,7 +98,7 @@ public function rewind() * * @return void */ - public function setMaxLimit($max) + public function setMaxLimit($max): void { $this->max = $max; } @@ -111,7 +111,7 @@ public function setMaxLimit($max) * * @return void */ - public function setMinLimit($min) + public function setMinLimit($min): void { $this->min = $min; } diff --git a/src/Iterators/PrimeFactors.php b/src/Iterators/PrimeFactors.php index ef37338..a9a2fd5 100644 --- a/src/Iterators/PrimeFactors.php +++ b/src/Iterators/PrimeFactors.php @@ -38,7 +38,7 @@ public function count(): int /** * {@inheritdoc} */ - public function current() + public function current(): mixed { return current($this->factors); } @@ -59,7 +59,7 @@ public function getNumber(): int * * @return void */ - public function next() + public function next(): void { ++$this->key; next($this->factors); @@ -68,7 +68,7 @@ public function next() /** * {@inheritdoc} */ - public function rewind() + public function rewind(): void { $this->key = 0; } @@ -81,7 +81,7 @@ public function rewind() * * @return void */ - public function setNumber($number) + public function setNumber($number): void { $this->number = $number; $this->factors = $this->getFactors($this->getNumber()); diff --git a/src/Iterators/Product.php b/src/Iterators/Product.php index 4e33465..9d9d0a0 100644 --- a/src/Iterators/Product.php +++ b/src/Iterators/Product.php @@ -53,7 +53,7 @@ public function count(): int /** * {@inheritdoc} */ - public function current() + public function current(): mixed { $tuple = []; @@ -69,7 +69,7 @@ public function current() * * @return void */ - public function next() + public function next(): void { foreach (array_reverse($this->iterators) as $key => $iterator) { $iterator->next(); @@ -95,7 +95,7 @@ public function next() * * @return void */ - public function rewind() + public function rewind(): void { foreach ($this->iterators as $iterator) { $iterator->rewind(); diff --git a/src/Iterators/Rotation.php b/src/Iterators/Rotation.php index 22e8f11..9a30bc9 100644 --- a/src/Iterators/Rotation.php +++ b/src/Iterators/Rotation.php @@ -41,7 +41,7 @@ public function count(): int /** * {@inheritdoc} */ - public function current() + public function current(): mixed { return $this->rotation; } @@ -54,7 +54,7 @@ public function current() * * @return void */ - public function next($offset = 1) + public function next($offset = 1): void { $offset = (null === $offset) ? 1 : $offset % $this->count(); $this->rotation = array_merge( @@ -73,7 +73,7 @@ public function next($offset = 1) /** * {@inheritdoc} */ - public function rewind() + public function rewind(): void { $this->rotation = $this->getDataset(); } diff --git a/src/Iterators/Shift.php b/src/Iterators/Shift.php index 478f277..af787ba 100644 --- a/src/Iterators/Shift.php +++ b/src/Iterators/Shift.php @@ -38,7 +38,7 @@ public function count(): int * * @return void */ - public function next() + public function next(): void { $this->doShift(1); } @@ -46,7 +46,7 @@ public function next() /** * {@inheritdoc} */ - public function rewind() + public function rewind(): void { $this->doShift(-1); } @@ -68,7 +68,7 @@ public function valid(): bool * * @return void */ - protected function doShift($length = 1) + protected function doShift($length = 1): void { $parameters = [];