Skip to content

Commit

Permalink
docs: Update typing information.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Dec 20, 2020
1 parent 17eac77 commit a1d636f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Iterator/MultipleIterableIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
final class MultipleIterableIterator extends ProxyIterator
{
/**
* @psalm-param iterable<TKey, T> $iterable
* @psalm-param iterable<TKey, T> $iterators
*/
public function __construct(iterable ...$iterators)
{
Expand Down
7 changes: 3 additions & 4 deletions src/Operation/Append.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace loophp\collection\Operation;

use Closure;
use Generator;
use Iterator;
use loophp\collection\Iterator\MultipleIterableIterator;

Expand All @@ -17,21 +16,21 @@
final class Append extends AbstractOperation
{
/**
* @psalm-return Closure(T...): Closure(Iterator<TKey, T>): Generator<int|TKey, T>
* @psalm-return Closure(T...): Closure(Iterator<TKey, T>): Iterator<int|TKey, T>
*/
public function __invoke(): Closure
{
return
/**
* @psalm-param T ...$items
*
* @psalm-return Closure(Iterator<TKey, T>): Generator<int|TKey, T>
* @psalm-return Closure(Iterator<TKey, T>): Iterator<int|TKey, T>
*/
static fn (...$items): Closure =>
/**
* @psalm-param Iterator<TKey, T> $iterator
*
* @psalm-return Generator<int|TKey, T>
* @psalm-return Iterator<int|TKey, T>
*/
static function (Iterator $iterator) use ($items): Iterator {
return new MultipleIterableIterator($iterator, $items);
Expand Down
2 changes: 1 addition & 1 deletion src/Operation/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __invoke(): Closure
*/
static fn (callable ...$callbacks): Closure =>
/**
* @psalm-param Iterator<TKey, T>
* @psalm-param Iterator<TKey, T> $iterator
*
* @psalm-return Generator<TKey, T>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Operation/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static function (Iterator $iterator) use ($callbacks): Generator {
/**
* @param mixed $carry
* @psalm-param T $carry
* @psalm-param callable(T, TKey): T $callback
* @psalm-param callable(T, TKey, Iterator<TKey, T>): T $callback
*
* @psalm-return T
*/
Expand Down
5 changes: 2 additions & 3 deletions src/Operation/Merge.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace loophp\collection\Operation;

use Closure;
use Generator;
use Iterator;
use loophp\collection\Iterator\MultipleIterableIterator;

Expand All @@ -17,7 +16,7 @@
final class Merge extends AbstractOperation
{
/**
* @psalm-return Closure(iterable<TKey, T>...): Closure(Iterator<TKey, T>): Generator<TKey, T>
* @psalm-return Closure(iterable<TKey, T>...): Closure(Iterator<TKey, T>): Iterator<TKey, T>
*/
public function __invoke(): Closure
{
Expand All @@ -29,7 +28,7 @@ public function __invoke(): Closure
/**
* @psalm-param Iterator<TKey, T> $iterator
*
* @psalm-return Generator<TKey, T>
* @psalm-return Iterator<TKey, T>
*/
static function (Iterator $iterator) use ($sources): Iterator {
return new MultipleIterableIterator($iterator, ...$sources);
Expand Down
7 changes: 3 additions & 4 deletions src/Operation/Prepend.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace loophp\collection\Operation;

use Closure;
use Generator;
use Iterator;
use loophp\collection\Iterator\MultipleIterableIterator;

Expand All @@ -17,21 +16,21 @@
final class Prepend extends AbstractOperation
{
/**
* @psalm-return Closure(T...): Closure(Iterator<TKey, T>): Generator<int|TKey, T>
* @psalm-return Closure(T...): Closure(Iterator<TKey, T>): Iterator<int|TKey, T>
*/
public function __invoke(): Closure
{
return
/**
* @psalm-param T ...$items
*
* @psalm-return Closure(Iterator<TKey, T>): Generator<int|TKey, T>
* @psalm-return Closure(Iterator<TKey, T>): Iterator<int|TKey, T>
*/
static fn (...$items): Closure =>
/**
* @psalm-param Iterator<TKey, T> $iterator
*
* @psalm-return Generator<int|TKey, T>
* @psalm-return Iterator<int|TKey, T>
*/
static function (Iterator $iterator) use ($items): Iterator {
return new MultipleIterableIterator($items, $iterator);
Expand Down

0 comments on commit a1d636f

Please sign in to comment.