From 0f2d0961c43135684423e2321c6bb640557e7bab Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 26 Jan 2021 22:03:39 +0100 Subject: [PATCH] docs: Update typing information. --- src/Operation/Last.php | 4 ++++ src/Operation/Unfold.php | 5 ++++- src/Operation/Unwindow.php | 5 ++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Operation/Last.php b/src/Operation/Last.php index 16cc3c1cf..fca0e552e 100644 --- a/src/Operation/Last.php +++ b/src/Operation/Last.php @@ -37,6 +37,10 @@ static function (Iterator $iterator): Iterator { return new EmptyIterator(); } + /** + * @psalm-var TKey $key + * @psalm-var T $current + */ return yield $key => $current; }; } diff --git a/src/Operation/Unfold.php b/src/Operation/Unfold.php index f5720d8c1..f76a4350c 100644 --- a/src/Operation/Unfold.php +++ b/src/Operation/Unfold.php @@ -40,7 +40,10 @@ public function __invoke(): Closure */ static function () use ($parameters, $callback): Generator { while (true) { - yield $parameters = $callback(...array_values((array) $parameters)); + /** @psalm-var T $parameters */ + $parameters = $callback(...array_values((array) $parameters)); + + yield $parameters; } }; } diff --git a/src/Operation/Unwindow.php b/src/Operation/Unwindow.php index 5df2c2026..fafffb98c 100644 --- a/src/Operation/Unwindow.php +++ b/src/Operation/Unwindow.php @@ -25,9 +25,12 @@ public function __invoke(): Closure /** * @psalm-param iterable> $iterable * - * @psalm-return T + * @psalm-return T|null */ static function (iterable $iterable) { + $value = null; + + /** @psalm-var T $value */ foreach ($iterable as $value) { }