Passed
Push — master ( 9d4bf9...615338 )
by Radosław
02:10
created

TrampolineThunk::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Baethon\Phln;
6
7
class TrampolineThunk
8
{
9
    private \Closure $fn;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_NS_SEPARATOR, expecting T_FUNCTION or T_CONST
Loading history...
10
11
    public function __construct(callable $fn)
12
    {
13
        $this->fn = \Closure::fromCallable($fn)
14
            ->bindTo($this);
15
    }
16
17
    /**
18
     * @param array<int, mixed> ...$args
19
     * @retun \Closure
20
     */
21
    public function __invoke(...$args): \Closure
22
    {
23
        $fn = $this->fn;
24
25
        return function () use ($args, $fn) {
26
            return $fn(...$args);
27
        };
28
    }
29
}
30