| Conditions | 3 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 2 | public function __invoke(): Closure |
|
| 23 | { |
||
| 24 | 2 | return |
|
| 25 | /** |
||
| 26 | * @return Closure(null|callable(int): (int|T)): Closure(): Generator<int, int|T> |
||
| 27 | */ |
||
| 28 | 2 | static fn (int $number = 0): Closure => |
|
| 29 | /** |
||
| 30 | * @return Closure(): Generator<int, int|T> |
||
| 31 | */ |
||
| 32 | 2 | static fn (?callable $callback = null): Closure => |
|
| 33 | /** |
||
| 34 | * @return Generator<int, int|T> |
||
| 35 | */ |
||
| 36 | 2 | static function () use ($number, $callback): Generator { |
|
| 37 | 2 | if (1 > $number) { |
|
| 38 | 2 | return; |
|
| 39 | } |
||
| 40 | |||
| 41 | 2 | $callback ??= static fn (int $value): int => $value; |
|
| 42 | |||
| 43 | 2 | for ($current = 1; $current <= $number; ++$current) { |
|
| 44 | 2 | yield $callback($current); |
|
| 45 | } |
||
| 49 |