Total Complexity | 6 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | final class CurriedFunction |
||
10 | { |
||
11 | private $f; |
||
12 | private $arity; |
||
13 | private $args; |
||
14 | |||
15 | public static function lift(callable $f): CurriedFunction |
||
16 | { |
||
17 | return new self($f, reflectionFunction($f)->getNumberOfRequiredParameters(), []); |
||
18 | } |
||
19 | |||
20 | public static function liftN(callable $f, int $arity): CurriedFunction |
||
21 | { |
||
22 | $requiredArity = reflectionFunction($f)->getNumberOfRequiredParameters(); |
||
23 | |||
24 | if ($arity < $requiredArity) { |
||
25 | throw new \ArgumentCountError(sprintf('Declared arity of function is %d, but required number of arguments is %d.', $arity, $requiredArity)); |
||
26 | } |
||
27 | |||
28 | return new self($f, $arity, []); |
||
29 | } |
||
30 | |||
31 | public function __invoke(...$args) |
||
32 | { |
||
33 | $callArgs = array_merge($this->args, $args); |
||
34 | |||
35 | if (\count($callArgs) >= $this->arity) { |
||
36 | return ($this->f)(...$callArgs); |
||
37 | } |
||
38 | |||
39 | return new self($this->f, $this->arity, $callArgs); |
||
40 | } |
||
41 | |||
42 | private function __construct(callable $f, int $arity, array $args) |
||
47 | } |
||
48 | } |
||
49 |
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