Passed
Push — master ( e3dd73...0b1820 )
by Pol
01:36
created

End   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 19
ccs 5
cts 5
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A of() 0 14 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace loophp\fpt;
6
7
use Closure;
8
9
// phpcs:disable Generic.Files.LineLength.TooLong
10
11
/**
12
 * @psalm-immutable
13
 *
14
 * @psalm-template T
15
 */
16
final class End
17
{
18
    /**
19
     * @psalm-pure
20
     */
21 1
    public static function of(): Closure
22
    {
23
        return
24
            /**
25
             * @psalm-param iterable<T> $iterable
26
             * @psalm-return ?T
27
             */
28 1
            static function (iterable $iterable) {
29 1
                $current = null;
30
31 1
                foreach ($iterable as $current) {
32
                }
33
34 1
                return $current;
35 1
            };
36
    }
37
}
38