Passed
Push — master ( defd4e...35ff3b )
by Pol
06:10 queued 03:00
created

U::on()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 8
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace loophp\combinator\Combinator;
6
7
use Closure;
8
use loophp\combinator\Combinator;
9
10
final class U extends Combinator
11
{
12
    /**
13
     * @suppress MissingClosureReturnType
14
     * @suppress MissingClosureParamType
15
     * @suppress MixedArgumentTypeCoercion
16
     */
17 2
    public function __invoke(): Closure
18
    {
19
        return
20
            /**
21
             * @param callable(callable): callable $f
22
             *
23
             * @return Closure(callable): mixed
24
             */
25
            static function (callable $f): Closure {
26
                return
27
                    /**
28
                     * @return mixed
29
                     */
30
                    static function (callable $g) use ($f) {
31 2
                        return $g(($f($f))($g));
32 2
                    };
33 2
            };
34
    }
35
}
36