Skip to content

Commit e4bb414

Browse files
committed
update code for PHP 8
1 parent f3b5a5e commit e4bb414

5 files changed

+8
-17
lines changed

src/ChunkIterableAggregate.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function getIterator(): Generator
4545
{
4646
$values = [];
4747

48-
foreach ($this->iterable as $key => $value) {
48+
foreach ($this->iterable as $value) {
4949
if (count($values) !== $this->chunkSize) {
5050
$values[] = $value;
5151

src/ClosureIterator.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
use Generator;
1313
use Iterator;
14-
use ReturnTypeWillChange;
1514

1615
/**
1716
* @template TKey
@@ -50,17 +49,15 @@ public function __construct(callable $callable, iterable $parameters = [])
5049
/**
5150
* @return T
5251
*/
53-
#[ReturnTypeWillChange]
54-
public function current()
52+
public function current(): mixed
5553
{
5654
return $this->generator->current();
5755
}
5856

5957
/**
6058
* @return TKey
6159
*/
62-
#[ReturnTypeWillChange]
63-
public function key()
60+
public function key(): mixed
6461
{
6562
return $this->generator->key();
6663
}

src/IterableIterator.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
use Generator;
1313
use Iterator;
14-
use ReturnTypeWillChange;
1514

1615
/**
1716
* @template TKey
@@ -45,17 +44,15 @@ public function __construct(iterable $iterable)
4544
/**
4645
* @return T
4746
*/
48-
#[ReturnTypeWillChange]
49-
public function current()
47+
public function current(): mixed
5048
{
5149
return $this->iterator->current();
5250
}
5351

5452
/**
5553
* @return TKey
5654
*/
57-
#[ReturnTypeWillChange]
58-
public function key()
55+
public function key(): mixed
5956
{
6057
return $this->iterator->key();
6158
}

src/ReductionIterableAggregate.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final class ReductionIterableAggregate implements IteratorAggregate
3030
/**
3131
* @var W
3232
*/
33-
private $initial;
33+
private mixed $initial;
3434

3535
/**
3636
* @var iterable<TKey, T>
@@ -42,7 +42,7 @@ final class ReductionIterableAggregate implements IteratorAggregate
4242
* @param (Closure(W, T, TKey, iterable<TKey, T>): W) $closure
4343
* @param W $initial
4444
*/
45-
public function __construct(iterable $iterable, Closure $closure, $initial)
45+
public function __construct(iterable $iterable, Closure $closure, mixed $initial)
4646
{
4747
$this->iterable = $iterable;
4848
$this->closure = $closure;

src/TypedIterableAggregate.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ public function __construct(iterable $iterable, ?callable $getType = null)
4444
$this->iterable = $iterable;
4545

4646
$this->getType = $getType ??
47-
/**
48-
* @param mixed $variable
49-
*/
50-
static function ($variable): string {
47+
static function (mixed $variable): string {
5148
if (!is_object($variable)) {
5249
return gettype($variable);
5350
}

0 commit comments

Comments
 (0)