Skip to content

Commit

Permalink
Update annotations.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Sep 2, 2020
1 parent ce64bca commit aa7edf9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/Operation/Flip.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@
*/
final class Flip extends AbstractOperation
{
/**
* @return Closure(Iterator<TKey, T>): Generator<T, TKey>
*/
public function __invoke(): Closure
{
return
/**
* @psalm-param Iterator<TKey, T> $iterator
*
* @psalm-return Generator<int|string, TKey>
* @psalm-return Generator<T, TKey>
*/
static function (Iterator $iterator): Generator {
foreach ($iterator as $key => $value) {
Expand Down
14 changes: 10 additions & 4 deletions src/Operation/Head.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@
final class Head extends AbstractOperation
{
/**
* @psalm-return Closure(Iterator<TKey, T>): (Generator<TKey, T>)
* @psalm-return Closure(Iterator<TKey, T>): Generator<TKey, T>
*/
public function __invoke(): Closure
{
return static function (Iterator $iterator): Generator {
return yield $iterator->key() => $iterator->current();
};
return
/**
* @psalm-param Iterator<TKey, T> $iterator
*
* @psalm-return Generator<TKey, T>
*/
static function (Iterator $iterator): Generator {
return yield $iterator->key() => $iterator->current();
};
}
}

0 comments on commit aa7edf9

Please sign in to comment.