Skip to content

Commit

Permalink
sa: Update typing information.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Dec 31, 2021
1 parent 58a3919 commit 351676b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Operation/Associate.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class Associate extends AbstractOperation
* @template NewTKey
* @template NewT
*
* @return Closure(callable(TKey=, T=, Iterator<TKey, T>=): NewTKey): Closure(callable(T=, TKey=, Iterator<TKey, T>=): NewT): Closure(Iterator<TKey, T>): Generator<NewTKey, NewT>
* @return Closure(callable(mixed=, mixed=, Iterator<mixed, mixed>=): mixed): Closure(callable(mixed=, mixed=, Iterator<mixed, mixed>=): mixed): Closure(Iterator<mixed, mixed>): Generator<mixed, mixed>
*/
public function __invoke(): Closure
{
Expand Down
4 changes: 2 additions & 2 deletions src/Operation/FlatMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ final class FlatMap extends AbstractOperation
* @template IKey
* @template IValue
*
* @return Closure(callable(T=, TKey=, Iterator<TKey, T>=): iterable<IKey, IValue>): Closure(Iterator<TKey, T>): Generator<IKey, IValue>
* @return Closure(callable(T=, TKey=, Iterator<TKey, T>=): iterable<mixed, mixed>): Closure(Iterator<TKey, T>): Generator<mixed, mixed>
*/
public function __invoke(): Closure
{
return
/**
* @param callable(T=, TKey=, Iterator<TKey, T>=): iterable<IKey, IValue> $callback
* @param callable(T=, TKey=, Iterator<TKey, T>=): iterable<mixed, mixed> $callback
*/
static function (callable $callback): Closure {
/** @var Closure(Iterator<TKey, T>): Generator<IKey, IValue> $flatMap */
Expand Down
4 changes: 2 additions & 2 deletions src/Operation/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ static function (iterable ...$iterables): Closure {
/**
* @param Iterator<int, list<T>> $as
*/
static fn (Iterator $as): Generator => FlatMap::of()(
static fn (Iterator $as): Generator => (new FlatMap())()(
/**
* @param list<T> $a
*/
static fn (array $a): Generator => FlatMap::of()(
static fn (array $a): Generator => (new FlatMap())()(
/**
* @param T|U $x
*
Expand Down
4 changes: 2 additions & 2 deletions src/Operation/Reduce.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class Reduce extends AbstractOperation
* @template V
* @template W
*
* @return Closure(callable((V|W)=, T=, TKey=, Iterator<TKey, T>=): W): Closure(V): Closure(Iterator<TKey, T>): Generator<TKey, W>
* @return Closure(callable(mixed=, mixed=, mixed=, Iterator<mixed, mixed>=): mixed): Closure(mixed): Closure(Iterator<TKey, T>): Generator<TKey, mixed>
*/
public function __invoke(): Closure
{
Expand All @@ -48,7 +48,7 @@ public function __invoke(): Closure
static function ($initial) use ($callback): Closure {
/** @var Closure(Iterator<TKey, T>): Generator<TKey, W> $pipe */
$pipe = Pipe::of()(
Reduction::of()($callback)($initial),
(new Reduction())()($callback)($initial),
Last::of(),
);

Expand Down
2 changes: 1 addition & 1 deletion src/Operation/Reduction.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class Reduction extends AbstractOperation
* @template V
* @template W
*
* @return Closure(callable((V|W)=, T=, TKey=, Iterator<TKey, T>=): W): Closure(V): Closure(Iterator<TKey, T>): Generator<TKey, W>
* @return Closure(callable(mixed=, mixed=, mixed=, Iterator<mixed, mixed>=): mixed): Closure(mixed): Closure(Iterator<TKey, T>): Generator<TKey, mixed>
*/
public function __invoke(): Closure
{
Expand Down
11 changes: 6 additions & 5 deletions src/Operation/Zip.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ static function (iterable ...$iterables): Closure {
),
]);

/** @var MultipleIterator<array-key, (Iterator<TKey, T>|Iterator<UKey, U>)> $buildMultipleIterator */
$buildMultipleIterator =
/**
* @return Closure(ArrayIterator<int, (Iterator<TKey, T>|IterableIterator<UKey, U>)>): MultipleIterator
*/
Reduce::of()(
/**
* @return Closure(ArrayIterator<int, (Iterator<TKey, T>|IterableIterator<UKey, U>)>): MultipleIterator
*/
(new Reduce())()(
/**
* @param Iterator<TKey, T> $iterator
*/
Expand All @@ -79,7 +80,7 @@ static function (MultipleIterator $acc, Iterator $iterator): MultipleIterator {

return $acc;
}
)(new MultipleIterator(MultipleIterator::MIT_NEED_ANY));
)(new MultipleIterator(MultipleIterator::MIT_NEED_ANY));

/** @var Closure(Iterator<TKey, T>): Generator<list<TKey|UKey>, list<T|U>> $pipe */
$pipe = Pipe::of()(
Expand Down

0 comments on commit 351676b

Please sign in to comment.