diff --git a/src/FilterIterableAggregate.php b/src/FilterIterableAggregate.php index f74c521..189b10b 100644 --- a/src/FilterIterableAggregate.php +++ b/src/FilterIterableAggregate.php @@ -21,18 +21,12 @@ */ final class FilterIterableAggregate implements IteratorAggregate { - /** - * @var Closure(T, TKey, iterable): bool - */ - private Closure $predicate; - /** * @param iterable $iterable * @param (Closure(T, TKey, iterable): bool) $predicate */ - public function __construct(private iterable $iterable, Closure $predicate) + public function __construct(private iterable $iterable, private Closure $predicate) { - $this->predicate = $predicate; } /** diff --git a/src/MapIterableAggregate.php b/src/MapIterableAggregate.php index 323da8e..e91725a 100644 --- a/src/MapIterableAggregate.php +++ b/src/MapIterableAggregate.php @@ -22,18 +22,12 @@ */ final class MapIterableAggregate implements IteratorAggregate { - /** - * @var Closure(T, TKey, iterable): W - */ - private Closure $closure; - /** * @param iterable $iterable * @param (Closure(T, TKey, iterable): W) $closure */ - public function __construct(private iterable $iterable, Closure $closure) + public function __construct(private iterable $iterable, private Closure $closure) { - $this->closure = $closure; } /** diff --git a/src/MersenneTwisterRNGIteratorAggregate.php b/src/MersenneTwisterRNGIteratorAggregate.php index 31efebb..93adbee 100644 --- a/src/MersenneTwisterRNGIteratorAggregate.php +++ b/src/MersenneTwisterRNGIteratorAggregate.php @@ -37,7 +37,7 @@ public function getIterator(): Generator // @phpstan-ignore-next-line while (true) { - yield mt_rand($this->min, $this->max); + yield random_int($this->min, $this->max); } } diff --git a/src/ReduceIterableAggregate.php b/src/ReduceIterableAggregate.php index 6759747..419392d 100644 --- a/src/ReduceIterableAggregate.php +++ b/src/ReduceIterableAggregate.php @@ -22,19 +22,13 @@ */ final class ReduceIterableAggregate implements IteratorAggregate { - /** - * @var Closure(W, T, TKey, iterable): W - */ - private Closure $closure; - /** * @param iterable $iterable * @param (Closure(W, T, TKey, iterable): W) $closure * @param W $initial */ - public function __construct(private iterable $iterable, Closure $closure, private mixed $initial) + public function __construct(private iterable $iterable, private Closure $closure, private mixed $initial) { - $this->closure = $closure; } /** diff --git a/src/ReductionIterableAggregate.php b/src/ReductionIterableAggregate.php index 47139a9..919010f 100644 --- a/src/ReductionIterableAggregate.php +++ b/src/ReductionIterableAggregate.php @@ -22,19 +22,13 @@ */ final class ReductionIterableAggregate implements IteratorAggregate { - /** - * @var Closure(W, T, TKey, iterable): W - */ - private Closure $closure; - /** * @param iterable $iterable * @param (Closure(W, T, TKey, iterable): W) $closure * @param W $initial */ - public function __construct(private iterable $iterable, Closure $closure, private mixed $initial) + public function __construct(private iterable $iterable, private Closure $closure, private mixed $initial) { - $this->closure = $closure; } /**