1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace loophp\collection\Operation; |
||
6 | |||
7 | use Closure; |
||
8 | use Generator; |
||
9 | use Symfony\Component\VarDumper\VarDumper; |
||
0 ignored issues
–
show
|
|||
10 | |||
11 | /** |
||
12 | * @immutable |
||
13 | * |
||
14 | * @template TKey |
||
15 | * @template T |
||
16 | */ |
||
17 | final class Dump extends AbstractOperation |
||
18 | { |
||
19 | /** |
||
20 | * @return Closure(string): Closure(int): Closure(?Closure): Closure(iterable<TKey, T>): Generator<TKey, T> |
||
21 | */ |
||
22 | 4 | public function __invoke(): Closure |
|
23 | { |
||
24 | 4 | return |
|
25 | /** |
||
26 | * @return Closure(int): Closure(?Closure): Closure(iterable<TKey, T>): Generator<TKey, T> |
||
27 | */ |
||
28 | 4 | static fn (string $name = ''): Closure => |
|
29 | /** |
||
30 | * @return Closure(?Closure): Closure(iterable<TKey, T>): Generator<TKey, T> |
||
31 | */ |
||
32 | 4 | static fn (int $size = -1): Closure => |
|
33 | /** |
||
34 | * @return Closure(iterable<TKey, T>): Generator<TKey, T> |
||
35 | */ |
||
36 | 4 | static fn (?Closure $callback = null): Closure => |
|
37 | /** |
||
38 | * @param iterable<TKey, T> $iterable |
||
39 | * |
||
40 | * @return Generator<TKey, T> |
||
41 | */ |
||
42 | 4 | static function (iterable $iterable) use ($name, $size, $callback): Generator { |
|
43 | 4 | $j = 0; |
|
44 | |||
45 | /** @var callable $debugFunction */ |
||
46 | 4 | $debugFunction = class_exists(VarDumper::class) ? 'dump' : 'var_dump'; |
|
47 | |||
48 | 4 | $callback ??= |
|
49 | /** |
||
50 | * @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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
51 | * @param T $value |
||
52 | */ |
||
53 | 4 | static fn (string $name, mixed $key, mixed $value): mixed => $debugFunction(['name' => $name, 'key' => $key, 'value' => $value]); |
|
54 | |||
55 | 4 | foreach ($iterable as $key => $value) { |
|
56 | 4 | yield $key => $value; |
|
57 | |||
58 | 4 | if (-1 === $size) { |
|
59 | 4 | continue; |
|
60 | } |
||
61 | |||
62 | 4 | if ($j++ < $size || 0 === $size) { |
|
63 | 4 | $callback($name, $key, $value); |
|
64 | |||
65 | 4 | continue; |
|
66 | } |
||
67 | |||
68 | 4 | $size = -1; |
|
69 | } |
||
70 | 4 | }; |
|
71 | } |
||
72 | } |
||
73 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths