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

S_::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 12
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
/**
11
 * Class S_.
12
 *
13
 * @template NewAType
14
 * @template NewBType
15
 * @template NewCType
16
 *
17
 * phpcs:disable Generic.Files.LineLength.TooLong
18
 * phpcs:disable Generic.WhiteSpace.ScopeIndent.IncorrectExact
19
 * phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps
20
 */
21
final class S_ extends Combinator
22
{
23
    /**
24
     * @psalm-return Closure(callable(NewAType): Closure(NewBType): NewCType): Closure(callable(NewBType): NewAType): Closure(NewBType): NewCType
25
     */
26
    public function __invoke(): Closure
27
    {
28
        return
29
            /**
30
             * @psalm-param callable(NewAType): Closure(NewBType): NewCType $f
31
             *
32
             * @psalm-return Closure(callable(NewBType): NewAType): Closure(NewBType): NewCType
33
             */
34
            static function (callable $f): Closure {
35
                return static function (callable $g) use ($f): Closure {
36
                    return static function ($x) use ($f, $g) {
37
                        return $f($g($x))($x);
38
                    };
39
                };
40
            };
41
    }
42
}
43