Issues (85)

src/Operation/Get.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 Get extends AbstractOperation
17
{
18
    /**
19
     * @template V
20
     *
21
     * @return Closure(TKey): Closure(V): Closure(iterable<TKey, T>): Generator<TKey, T|V>
22
     */
23 124
    public function __invoke(): Closure
24
    {
25 124
        return
26
            /**
27
             * @param TKey $keyToGet
28
             *
29
             * @return Closure(V): Closure(iterable<TKey, T>): Generator<TKey, T|V>
30
             */
31 124
            static fn (mixed $keyToGet): Closure =>
32
                /**
33
                 * @param V $default
0 ignored issues
show
The type loophp\collection\Operation\V 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...
34
                 *
35
                 * @return Closure(iterable<TKey, T>): Generator<TKey, T|V>
36
                 */
37 124
                static function (mixed $default) use ($keyToGet): Closure {
38
                    /** @var Closure(iterable<TKey, T>): (Generator<TKey, T|V>) $pipe */
39 124
                    $pipe = (new Pipe())()(
40 124
                        (new Filter())()(
41
                            /**
42
                             * @param T $value
43
                             * @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...
44
                             */
45 124
                            static fn (mixed $value, mixed $key): bool => $key === $keyToGet
46 124
                        ),
47 124
                        (new Append())()([$default]),
48 124
                        (new Head())()
49 124
                    );
50
51
                    // Point free style.
52 124
                    return $pipe;
53 124
                };
54
    }
55
}
56