Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add more missing return type hints && tag it 1.4.1 #18

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Iterators.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ abstract class Iterators extends Combinatorics implements Countable, IteratorInt
/**
* {@inheritdoc}
*/
public function current()
public function current(): mixed
{
return $this->current;
}

/**
* {@inheritdoc}
*/
public function key()
public function key(): int
{
return $this->key;
}
Expand All @@ -41,7 +41,7 @@ public function key()
*
* @return void
*/
public function rewind()
public function rewind(): void
{
$this->key = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Iterators/Combinations.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function count(): int
/**
* {@inheritdoc}
*/
public function current()
public function current(): mixed
{
$r = [];

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/Iterators/Cycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function count(): int
/**
* {@inheritdoc}
*/
public function current()
public function current(): mixed
{
return $this->dataset[$this->key];
}
Expand All @@ -39,7 +39,7 @@ public function next()
/**
* {@inheritdoc}
*/
public function rewind()
public function rewind(): void
{
$this->key = 0;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Iterators/Fibonacci.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -63,7 +63,7 @@ public function next()
/**
* {@inheritdoc}
*/
public function rewind()
public function rewind(): void
{
$this->previous = 1;
$this->current = 0;
Expand All @@ -78,7 +78,7 @@ public function rewind()
*
* @return void
*/
public function setMaxLimit($max)
public function setMaxLimit($max): void
{
$this->max = $max;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Iterators/FiniteGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function count(): int
/**
* {@inheritdoc}
*/
public function current()
public function current(): mixed
{
return current($this->group);
}
Expand All @@ -64,7 +64,7 @@ public function getSize(): int
*
* @return void
*/
public function next()
public function next(): void
{
++$this->key;
next($this->group);
Expand Down Expand Up @@ -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();
Expand All @@ -120,7 +120,7 @@ public function valid(): bool
*
* @return void
*/
private function computeGroup()
private function computeGroup(): void
{
$this->group = [];

Expand Down
6 changes: 3 additions & 3 deletions src/Iterators/NGrams.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(array $dataset = [], $length = 1)
/**
* {@inheritdoc}
*/
public function current()
public function current(): mixed
{
return $this->currentValue;
}
Expand All @@ -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());
Expand All @@ -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());
Expand Down
10 changes: 5 additions & 5 deletions src/Iterators/Perfect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -77,15 +77,15 @@ public function getMinLimit(): int
*
* @return void
*/
public function next()
public function next(): void
{
++$this->key;
}

/**
* {@inheritdoc}
*/
public function rewind()
public function rewind(): void
{
$this->key = $this->getMinLimit();
}
Expand All @@ -98,7 +98,7 @@ public function rewind()
*
* @return void
*/
public function setMaxLimit($max)
public function setMaxLimit($max): void
{
$this->max = $max;
}
Expand All @@ -111,7 +111,7 @@ public function setMaxLimit($max)
*
* @return void
*/
public function setMinLimit($min)
public function setMinLimit($min): void
{
$this->min = $min;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Iterators/Prime.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -77,15 +77,15 @@ public function getMinLimit(): int
*
* @return void
*/
public function next()
public function next(): void
{
++$this->key;
}

/**
* {@inheritdoc}
*/
public function rewind()
public function rewind(): void
{
$this->key = $this->getMinLimit();
}
Expand All @@ -98,7 +98,7 @@ public function rewind()
*
* @return void
*/
public function setMaxLimit($max)
public function setMaxLimit($max): void
{
$this->max = $max;
}
Expand All @@ -111,7 +111,7 @@ public function setMaxLimit($max)
*
* @return void
*/
public function setMinLimit($min)
public function setMinLimit($min): void
{
$this->min = $min;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Iterators/PrimeFactors.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function count(): int
/**
* {@inheritdoc}
*/
public function current()
public function current(): mixed
{
return current($this->factors);
}
Expand All @@ -59,7 +59,7 @@ public function getNumber(): int
*
* @return void
*/
public function next()
public function next(): void
{
++$this->key;
next($this->factors);
Expand All @@ -68,7 +68,7 @@ public function next()
/**
* {@inheritdoc}
*/
public function rewind()
public function rewind(): void
{
$this->key = 0;
}
Expand All @@ -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());
Expand Down
6 changes: 3 additions & 3 deletions src/Iterators/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function count(): int
/**
* {@inheritdoc}
*/
public function current()
public function current(): mixed
{
$tuple = [];

Expand All @@ -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();
Expand All @@ -95,7 +95,7 @@ public function next()
*
* @return void
*/
public function rewind()
public function rewind(): void
{
foreach ($this->iterators as $iterator) {
$iterator->rewind();
Expand Down
6 changes: 3 additions & 3 deletions src/Iterators/Rotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function count(): int
/**
* {@inheritdoc}
*/
public function current()
public function current(): mixed
{
return $this->rotation;
}
Expand All @@ -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(
Expand All @@ -73,7 +73,7 @@ public function next($offset = 1)
/**
* {@inheritdoc}
*/
public function rewind()
public function rewind(): void
{
$this->rotation = $this->getDataset();
}
Expand Down
6 changes: 3 additions & 3 deletions src/Iterators/Shift.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public function count(): int
*
* @return void
*/
public function next()
public function next(): void
{
$this->doShift(1);
}

/**
* {@inheritdoc}
*/
public function rewind()
public function rewind(): void
{
$this->doShift(-1);
}
Expand All @@ -68,7 +68,7 @@ public function valid(): bool
*
* @return void
*/
protected function doShift($length = 1)
protected function doShift($length = 1): void
{
$parameters = [];

Expand Down
Loading