1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace loophp\collection\Operation; |
6
|
|
|
|
7
|
|
|
use Closure; |
8
|
|
|
use Generator; |
9
|
|
|
use loophp\collection\Utils\CallbacksArrayReducer; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @immutable |
13
|
|
|
* |
14
|
|
|
* @template TKey |
15
|
|
|
* @template T |
16
|
|
|
*/ |
17
|
|
|
final class MatchOne extends AbstractOperation |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @return Closure(callable(T, TKey, iterable<TKey, T>): bool ...): Closure(callable(T, TKey, iterable<TKey, T>): bool ...): Closure(iterable<TKey, T>): Generator<TKey, bool> |
21
|
|
|
*/ |
22
|
54 |
|
public function __invoke(): Closure |
23
|
|
|
{ |
24
|
54 |
|
return |
25
|
|
|
/** |
26
|
|
|
* @param callable(T, TKey, iterable<TKey, T>): bool ...$matchers |
27
|
|
|
* |
28
|
|
|
* @return Closure(callable(T, TKey, iterable<TKey, T>): bool ...): Closure(iterable<TKey, T>): Generator<TKey, bool> |
29
|
|
|
*/ |
30
|
54 |
|
static fn (callable ...$matchers): Closure => |
31
|
|
|
/** |
32
|
|
|
* @param callable(T, TKey, iterable<TKey, T>): bool ...$callbacks |
33
|
|
|
* |
34
|
|
|
* @return Closure(iterable<TKey, T>): Generator<TKey, bool> |
35
|
|
|
*/ |
36
|
54 |
|
static function (callable ...$callbacks) use ($matchers): Closure { |
37
|
54 |
|
$callback = CallbacksArrayReducer::or()($callbacks); |
38
|
54 |
|
$matcher = CallbacksArrayReducer::or()($matchers); |
39
|
|
|
|
40
|
|
|
/** @var Closure(iterable<TKey, T>): Generator<TKey, bool> $pipe */ |
41
|
54 |
|
$pipe = (new Pipe())()( |
42
|
54 |
|
(new Every())()( |
43
|
|
|
/** |
44
|
|
|
* @param T $value |
45
|
|
|
* @param TKey $key |
|
|
|
|
46
|
|
|
*/ |
47
|
54 |
|
static fn (int $index, mixed $value, mixed $key, iterable $iterable): bool => $callback($value, $key, $iterable) !== $matcher($value, $key, $iterable) |
48
|
54 |
|
), |
49
|
54 |
|
(new Map())()( |
50
|
54 |
|
static fn (bool $i): bool => !$i |
51
|
54 |
|
) |
52
|
54 |
|
); |
53
|
|
|
|
54
|
|
|
// Point free style. |
55
|
54 |
|
return $pipe; |
56
|
54 |
|
}; |
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