diff --git a/phpstan.neon b/phpstan.neon index 71e5eef..2ea78e5 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -17,11 +17,6 @@ parameters: count: 1 path: src/Collection/Stream/Collectors.php - - - message: "#Unreachable statement - code above always terminates.#" - count: 1 - path: src/Collection/Iterator.php - - message: "#Template type T of method#" count: 6 diff --git a/src/Collection/Iterator.php b/src/Collection/Iterator.php index 8d87257..2b03633 100644 --- a/src/Collection/Iterator.php +++ b/src/Collection/Iterator.php @@ -72,6 +72,9 @@ public static function fromIterable(iterable $elements): self return new ArrayIterator($elements); } + /** + * @phpstan-impure + */ public function hasNext(): bool { return !$this->current->isEmpty(); @@ -140,7 +143,7 @@ public function reduce(callable $operation) } $accumulator = $this->next(); - while ($this->hasNext()) { // @phpstan-ignore-line + while ($this->hasNext()) { $accumulator = $operation($accumulator, $this->next()); }