Issues (85)

src/Operation/Tails.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace loophp\collection\Operation;
6
7
use Closure;
8
use Generator;
9
use loophp\iterators\IterableIteratorAggregate;
10
11
use function array_slice;
12
13
/**
14
 * @immutable
15
 *
16
 * @template TKey
17
 * @template T
18
 */
19
final class Tails extends AbstractOperation
20
{
21
    /**
22
     * @return Closure(iterable<TKey, T>): Generator<int, list<T>>
23
     */
24 4
    public function __invoke(): Closure
25
    {
26 4
        return
27
            /**
28
             * @param iterable<TKey, T> $iterable
29
             *
30
             * @return Generator<int, list<T>>
31
             */
32 4
            static function (iterable $iterable): Generator {
33 4
                $initial = iterator_to_array(
34 4
                    (new IterableIteratorAggregate($iterable))->getIterator()
35 4
                );
36
37 4
                $reduction =
38
                    /**
39
                     * @param list<T> $stack
0 ignored issues
show
The type loophp\collection\Operation\list was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
40
                     *
41
                     * @return list<T>
42
                     */
43 4
                    static fn (array $stack): array => array_slice($stack, 1);
44
45
                /** @var Closure(iterable<TKey, T>): Generator<int, list<T>> $pipe */
46 4
                $pipe = (new Pipe())()(
47 4
                    (new Reduction())()($reduction)($initial),
48 4
                    (new Normalize())(),
49 4
                );
50
51 4
                yield from $pipe($iterable);
52 4
            };
53
    }
54
}
55