Skip to content

Commit d1e9f98

Browse files
authored
Merge pull request #18 from yemilgr/returns-type-hints
add more missing return type hints && tag it 1.4.1
2 parents 00a3d1d + b326e9f commit d1e9f98

File tree

12 files changed

+40
-40
lines changed

12 files changed

+40
-40
lines changed

src/Iterators.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ abstract class Iterators extends Combinatorics implements Countable, IteratorInt
2323
/**
2424
* {@inheritdoc}
2525
*/
26-
public function current()
26+
public function current(): mixed
2727
{
2828
return $this->current;
2929
}
3030

3131
/**
3232
* {@inheritdoc}
3333
*/
34-
public function key()
34+
public function key(): int
3535
{
3636
return $this->key;
3737
}
@@ -41,7 +41,7 @@ public function key()
4141
*
4242
* @return void
4343
*/
44-
public function rewind()
44+
public function rewind(): void
4545
{
4646
$this->key = 0;
4747
}

src/Iterators/Combinations.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function count(): int
4646
/**
4747
* {@inheritdoc}
4848
*/
49-
public function current()
49+
public function current(): mixed
5050
{
5151
$r = [];
5252

@@ -74,7 +74,7 @@ public function next(): void
7474
/**
7575
* {@inheritdoc}
7676
*/
77-
public function rewind()
77+
public function rewind(): void
7878
{
7979
$this->c = range(0, $this->length);
8080
$this->key = 0;

src/Iterators/Cycle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function count(): int
2121
/**
2222
* {@inheritdoc}
2323
*/
24-
public function current()
24+
public function current(): mixed
2525
{
2626
return $this->dataset[$this->key];
2727
}
@@ -39,7 +39,7 @@ public function next()
3939
/**
4040
* {@inheritdoc}
4141
*/
42-
public function rewind()
42+
public function rewind(): void
4343
{
4444
$this->key = 0;
4545
}

src/Iterators/Fibonacci.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function getMaxLimit(): int
5454
*
5555
* @return void
5656
*/
57-
public function next()
57+
public function next(): void
5858
{
5959
[$this->current, $this->previous] = [$this->current + $this->previous, $this->current];
6060
++$this->key;
@@ -63,7 +63,7 @@ public function next()
6363
/**
6464
* {@inheritdoc}
6565
*/
66-
public function rewind()
66+
public function rewind(): void
6767
{
6868
$this->previous = 1;
6969
$this->current = 0;
@@ -78,7 +78,7 @@ public function rewind()
7878
*
7979
* @return void
8080
*/
81-
public function setMaxLimit($max)
81+
public function setMaxLimit($max): void
8282
{
8383
$this->max = $max;
8484
}

src/Iterators/FiniteGroup.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function count(): int
4343
/**
4444
* {@inheritdoc}
4545
*/
46-
public function current()
46+
public function current(): mixed
4747
{
4848
return current($this->group);
4949
}
@@ -64,7 +64,7 @@ public function getSize(): int
6464
*
6565
* @return void
6666
*/
67-
public function next()
67+
public function next(): void
6868
{
6969
++$this->key;
7070
next($this->group);
@@ -99,7 +99,7 @@ public function order($generator): int
9999
*
100100
* @return void
101101
*/
102-
public function setSize($size)
102+
public function setSize($size): void
103103
{
104104
$this->size = $size;
105105
$this->computeGroup();
@@ -120,7 +120,7 @@ public function valid(): bool
120120
*
121121
* @return void
122122
*/
123-
private function computeGroup()
123+
private function computeGroup(): void
124124
{
125125
$this->group = [];
126126

src/Iterators/NGrams.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(array $dataset = [], $length = 1)
3535
/**
3636
* {@inheritdoc}
3737
*/
38-
public function current()
38+
public function current(): mixed
3939
{
4040
return $this->currentValue;
4141
}
@@ -45,7 +45,7 @@ public function current()
4545
*
4646
* @return void
4747
*/
48-
public function next()
48+
public function next(): void
4949
{
5050
parent::next();
5151
$this->currentValue = array_slice($this->current, 0, $this->getLength());
@@ -56,7 +56,7 @@ public function next()
5656
*
5757
* @return void
5858
*/
59-
public function rewind()
59+
public function rewind(): void
6060
{
6161
parent::rewind();
6262
$this->currentValue = array_slice($this->current, 0, $this->getLength());

src/Iterators/Perfect.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct()
3737
/**
3838
* {@inheritdoc}
3939
*/
40-
public function current()
40+
public function current(): mixed
4141
{
4242
for ($i = $this->key(); $this->getMaxLimit() > $i; ++$i) {
4343
if ($this->isPerfectNumber($i)) {
@@ -77,15 +77,15 @@ public function getMinLimit(): int
7777
*
7878
* @return void
7979
*/
80-
public function next()
80+
public function next(): void
8181
{
8282
++$this->key;
8383
}
8484

8585
/**
8686
* {@inheritdoc}
8787
*/
88-
public function rewind()
88+
public function rewind(): void
8989
{
9090
$this->key = $this->getMinLimit();
9191
}
@@ -98,7 +98,7 @@ public function rewind()
9898
*
9999
* @return void
100100
*/
101-
public function setMaxLimit($max)
101+
public function setMaxLimit($max): void
102102
{
103103
$this->max = $max;
104104
}
@@ -111,7 +111,7 @@ public function setMaxLimit($max)
111111
*
112112
* @return void
113113
*/
114-
public function setMinLimit($min)
114+
public function setMinLimit($min): void
115115
{
116116
$this->min = $min;
117117
}

src/Iterators/Prime.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct()
3737
/**
3838
* {@inheritdoc}
3939
*/
40-
public function current()
40+
public function current(): mixed
4141
{
4242
for ($i = $this->key(); $this->getMaxLimit() > $i; ++$i) {
4343
if ($this->isPrimeNumber($i)) {
@@ -77,15 +77,15 @@ public function getMinLimit(): int
7777
*
7878
* @return void
7979
*/
80-
public function next()
80+
public function next(): void
8181
{
8282
++$this->key;
8383
}
8484

8585
/**
8686
* {@inheritdoc}
8787
*/
88-
public function rewind()
88+
public function rewind(): void
8989
{
9090
$this->key = $this->getMinLimit();
9191
}
@@ -98,7 +98,7 @@ public function rewind()
9898
*
9999
* @return void
100100
*/
101-
public function setMaxLimit($max)
101+
public function setMaxLimit($max): void
102102
{
103103
$this->max = $max;
104104
}
@@ -111,7 +111,7 @@ public function setMaxLimit($max)
111111
*
112112
* @return void
113113
*/
114-
public function setMinLimit($min)
114+
public function setMinLimit($min): void
115115
{
116116
$this->min = $min;
117117
}

src/Iterators/PrimeFactors.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function count(): int
3838
/**
3939
* {@inheritdoc}
4040
*/
41-
public function current()
41+
public function current(): mixed
4242
{
4343
return current($this->factors);
4444
}
@@ -59,7 +59,7 @@ public function getNumber(): int
5959
*
6060
* @return void
6161
*/
62-
public function next()
62+
public function next(): void
6363
{
6464
++$this->key;
6565
next($this->factors);
@@ -68,7 +68,7 @@ public function next()
6868
/**
6969
* {@inheritdoc}
7070
*/
71-
public function rewind()
71+
public function rewind(): void
7272
{
7373
$this->key = 0;
7474
}
@@ -81,7 +81,7 @@ public function rewind()
8181
*
8282
* @return void
8383
*/
84-
public function setNumber($number)
84+
public function setNumber($number): void
8585
{
8686
$this->number = $number;
8787
$this->factors = $this->getFactors($this->getNumber());

src/Iterators/Product.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function count(): int
5353
/**
5454
* {@inheritdoc}
5555
*/
56-
public function current()
56+
public function current(): mixed
5757
{
5858
$tuple = [];
5959

@@ -69,7 +69,7 @@ public function current()
6969
*
7070
* @return void
7171
*/
72-
public function next()
72+
public function next(): void
7373
{
7474
foreach (array_reverse($this->iterators) as $key => $iterator) {
7575
$iterator->next();
@@ -95,7 +95,7 @@ public function next()
9595
*
9696
* @return void
9797
*/
98-
public function rewind()
98+
public function rewind(): void
9999
{
100100
foreach ($this->iterators as $iterator) {
101101
$iterator->rewind();

0 commit comments

Comments
 (0)