Passed
Push — master ( 2973d6...b68962 )
by Pol
12:52
created

S2   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 13 1
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
/**
11
 * Class S2.
12
 *
13
 * @template NewAType
14
 * @template NewBType
15
 * @template NewCType
16
 * @template NewDType
17
 *
18
 * phpcs:disable Generic.Files.LineLength.TooLong
19
 * phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
20
 */
21
final class S2 extends Combinator
22
{
23
    /**
24
     * @psalm-return Closure(callable(NewBType): Closure(NewCType): NewDType): Closure(callable(NewAType): NewBType): Closure(callable(NewAType): NewCType): Closure(NewAType): NewDType
25
     */
26
    public function __invoke(): Closure
27
    {
28
        return
29
            /**
30
             * @psalm-param callable(NewBType): Closure(NewCType): NewDType $f
31
             *
32
             * @psalm-return Closure(callable(NewAType): NewBType): Closure(callable(NewAType): NewCType): Closure(NewAType): NewDType
33
             */
34
            static function (callable $f): Closure {
35
                return static function (callable $g) use ($f): Closure {
36
                    return static function (callable $h) use ($f, $g): Closure {
37
                        return static function ($x) use ($f, $g, $h) {
38
                            return $f($g($x))($h($x));
39
                        };
40
                    };
41
                };
42
            };
43
    }
44
}
45