From 643b90c2ad60d8ce68a057984af79cf8f7864349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Costa?= Date: Fri, 12 Apr 2024 11:47:09 +0200 Subject: [PATCH] fix(add-paging-to-result-set): fixed type-hinting --- src/ResultSet.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/ResultSet.php b/src/ResultSet.php index 8df41e7..79eb454 100644 --- a/src/ResultSet.php +++ b/src/ResultSet.php @@ -9,19 +9,19 @@ use Traversable; /** - * Dataset containing hydrated data by {@see Hydrator} in form of {@see Model} entries from the given {@see Query} + * Dataset containing database rows * - * @implements Iterator + * @implements Iterator */ class ResultSet implements Iterator { - /** @var ArrayIterator */ + /** @var ArrayIterator */ protected $cache; /** @var bool Whether cache is disabled */ protected $isCacheDisabled = false; - /** @var Generator */ + /** @var Generator */ protected $generator; /** @var ?int */ @@ -37,7 +37,7 @@ class ResultSet implements Iterator protected $pageSize; /** - * @param Traversable $traversable + * @param Traversable $traversable * @param ?int $limit * @param ?int $offset */ @@ -85,10 +85,8 @@ public function hasResult(): bool return $this->generator->valid(); } - /** - * @return ?Model - */ - public function current(): ?Model + #[\ReturnTypeWillChange] + public function current() { if ($this->position === null) { $this->advance(); @@ -111,7 +109,7 @@ public function next(): void } } - public function key(): int + public function key(): ?int { if ($this->position === null) { $this->advance(); @@ -163,7 +161,7 @@ protected function advance(): void } /** - * @param Traversable $traversable + * @param Traversable $traversable * @return Generator */ protected function yieldTraversable(Traversable $traversable): Generator