Issues (16)

src/Args.php (3 issues)

1
<?php
2
3
/**
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 */
7
8
declare(strict_types=1);
9
10
namespace loophp\fpt;
11
12
use Closure;
13
14
use function array_slice;
15
16
// phpcs:disable Generic.Files.LineLength.TooLong
17
18
/**
19
 * @psalm-immutable
20
 *
21
 * @template T
22
 */
23
final class Args
24
{
25
    /**
26
     * @pure
27
     */
28 2
    public static function of(): Closure
29
    {
30
        return
31
            /**
32
             * @param positive-int $index
0 ignored issues
show
Documentation Bug introduced by
The doc comment positive-int at position 0 could not be parsed: Unknown type name 'positive-int' at position 0 in positive-int.
Loading history...
33
             */
34 2
            static fn (int $offset): Closure =>
35
                /**
36
                 * @param positive-int $index
0 ignored issues
show
Documentation Bug introduced by
The doc comment positive-int at position 0 could not be parsed: Unknown type name 'positive-int' at position 0 in positive-int.
Loading history...
37
                 */
38 2
                static fn (int $length): Closure =>
39
                    /**
40
                     * @param T ...$args
41
                     *
42
                     * @return array<array-key, T>
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<array-key, T> at position 2 could not be parsed: Unknown type name 'array-key' at position 2 in array<array-key, T>.
Loading history...
43
                     */
44 2
                    static fn (...$args): array => array_slice($args, $offset, $length, true);
45
    }
46
}
47