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 IfThenElse extends AbstractOperation |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @return Closure(callable(T, TKey, iterable<TKey, T>): bool): Closure(callable(T, TKey, iterable<TKey, T>): T): Closure(callable(T, TKey, iterable<TKey, T>): T): Closure(iterable<TKey, T>): Generator<TKey, T> |
20
|
|
|
*/ |
21
|
4 |
|
public function __invoke(): Closure |
22
|
|
|
{ |
23
|
4 |
|
return |
24
|
|
|
/** |
25
|
|
|
* @param callable(T, TKey, iterable<TKey, T>): bool $condition |
26
|
|
|
* |
27
|
|
|
* @return Closure(callable(T, TKey, iterable<TKey, T>): T): Closure(callable(T, TKey, iterable<TKey, T>): T): Closure(iterable<TKey, T>): Generator<TKey, T> |
28
|
|
|
*/ |
29
|
4 |
|
static fn (callable $condition): Closure => |
30
|
|
|
/** |
31
|
|
|
* @param callable(T, TKey, iterable<TKey, T>): T $then |
32
|
|
|
* |
33
|
|
|
* @return Closure(callable(T, TKey, iterable<TKey, T>): T): Closure(iterable<TKey, T>): Generator<TKey, T> |
34
|
|
|
*/ |
35
|
4 |
|
static fn (callable $then): Closure => |
36
|
|
|
/** |
37
|
|
|
* @param callable(T, TKey, iterable<TKey, T>):T $else |
38
|
|
|
* |
39
|
|
|
* @return Closure(iterable<TKey, T>): Generator<TKey, T> |
40
|
|
|
*/ |
41
|
4 |
|
static function (callable $else) use ($condition, $then): Closure { |
42
|
|
|
/** @var Closure(iterable<TKey, T>): Generator<TKey, T> $map */ |
43
|
4 |
|
$map = (new Map())()( |
44
|
|
|
/** |
45
|
|
|
* @param T $value |
46
|
|
|
* @param TKey $key |
|
|
|
|
47
|
|
|
* @param iterable<TKey, T> $iterable |
48
|
|
|
* |
49
|
|
|
* @return T |
50
|
|
|
*/ |
51
|
4 |
|
static fn (mixed $value, mixed $key, iterable $iterable): mixed => $condition($value, $key, $iterable) ? $then($value, $key, $iterable) : $else($value, $key, $iterable) |
52
|
4 |
|
); |
53
|
|
|
|
54
|
|
|
// Point free style. |
55
|
4 |
|
return $map; |
56
|
4 |
|
}; |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
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