Issues (85)

src/Operation/Reverse.php (2 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace loophp\collection\Operation;
6
7
use Closure;
8
use Generator;
9
10
/**
11
 * @immutable
12
 *
13
 * @template TKey
14
 * @template T
15
 */
16
final class Reverse extends AbstractOperation
17
{
18
    /**
19
     * @return Closure(iterable<TKey, T>): Generator<TKey, T>
20
     */
21 64
    public function __invoke(): Closure
22
    {
23 64
        $callback =
24
            /**
25
             * @param T $value
26
             * @param TKey $key
0 ignored issues
show
The type loophp\collection\Operation\TKey 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...
27
             * @param list<array{0: TKey, 1: T}> $carry
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...
28
             *
29
             * @return list<array{0: TKey, 1: T}>
30
             */
31 64
            static fn (array $carry, mixed $value, mixed $key): array => [[$key, $value], ...$carry];
32
33
        /** @var Closure(iterable<TKey, T>): Generator<TKey, T> $pipe */
34 64
        $pipe = (new Pipe())()(
35 64
            (new Reduce())()($callback)([]),
36 64
            (new Unwrap())(),
37 64
            (new Unpack())()
38 64
        );
39
40
        // Point free style.
41 64
        return $pipe;
42
    }
43
}
44