Skip to content

Commit

Permalink
refactor: minor SA update Tails operation
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Feb 20, 2024
1 parent 179c2a5 commit acb6d8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
7 changes: 1 addition & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,14 @@ parameters:

-
message: "#^Parameter \\#1 \\$callable of class loophp\\\\collection\\\\Collection constructor expects callable\\(mixed \\.\\.\\.\\)\\: iterable\\<int, array\\<int, mixed\\>\\>, Closure\\(iterable\\)\\: Generator\\<int, array\\<int, mixed\\>, mixed, mixed\\> given\\.$#"
count: 1
count: 2
path: src/Collection.php

-
message: "#^Parameter \\#1 \\$callable of class loophp\\\\collection\\\\Collection constructor expects callable\\(mixed \\.\\.\\.\\)\\: iterable\\<int, array\\<int, mixed\\>\\>, Closure\\(iterable\\<array\\<int, mixed\\>\\>\\)\\: Generator\\<int, array\\<int, mixed\\>, mixed, mixed\\> given\\.$#"
count: 1
path: src/Collection.php

-
message: "#^Parameter \\#1 \\$callable of class loophp\\\\collection\\\\Collection constructor expects callable\\(mixed \\.\\.\\.\\)\\: iterable\\<int, array\\<int, mixed\\>\\>, Closure\\(iterable\\<int\\|string, mixed\\>\\)\\: Generator\\<int, array\\<int, mixed\\>, mixed, mixed\\> given\\.$#"
count: 1
path: src/Collection.php

-
message: "#^Parameter \\#1 \\$callable of class loophp\\\\collection\\\\Collection constructor expects callable\\(mixed \\.\\.\\.\\)\\: iterable\\<int, array\\<int\\|string, mixed\\>\\>, Closure\\(iterable\\)\\: Generator\\<int, array\\<int\\|string, mixed\\>, mixed, mixed\\> given\\.$#"
count: 1
Expand Down
10 changes: 5 additions & 5 deletions src/Operation/Tails.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
final class Tails extends AbstractOperation
{
/**
* @return Closure(iterable<array-key, T>): Generator<int, list<T>>
* @return Closure(iterable<TKey, T>): Generator<int, list<T>>
*/
public function __invoke(): Closure
{
return
/**
* @param iterable<array-key, T> $iterable
* @param iterable<TKey, T> $iterable
*
* @return Generator<int, list<T>>
*/
static function (iterable $iterable): Generator {
$generator = iterator_to_array(
$initial = iterator_to_array(
(new IterableIteratorAggregate($iterable))->getIterator()
);

Expand All @@ -42,9 +42,9 @@ static function (iterable $iterable): Generator {
*/
static fn (array $stack): array => array_slice($stack, 1);

/** @var Closure(iterable<array-key, T>): Generator<int, list<T>> $pipe */
/** @var Closure(iterable<TKey, T>): Generator<int, list<T>> $pipe */
$pipe = (new Pipe())()(
(new Reduction())()($reduction)($generator),
(new Reduction())()($reduction)($initial),
(new Normalize())(),
);

Expand Down

0 comments on commit acb6d8f

Please sign in to comment.