GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( f6a56c...d30871 )
by Cees-Jan
09:15 queued 15s
created

DefinitionsGatherer::requires()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PHPDIDefinitions;
6
7
use function glob;
8
use function is_array;
9
use function strpos;
10
use function WyriHaximus\get_in_packages_composer_path;
11 1
12
final class DefinitionsGatherer
13 1
{
14 1
    private const string LOCATION = 'extra.php-di-definitions.di';
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_STRING, expecting '=' on line 14 at column 25
Loading history...
15
16 1
    /** @return iterable<string, mixed> */
17
    public static function gather(string $location = self::LOCATION): iterable
18 1
    {
19 1
        yield from self::requires(get_in_packages_composer_path($location));
20
    }
21 1
22
    /**
23 1
     * @param iterable<string> $files
24
     *
25 1
     * @return iterable<string, mixed>
26 1
     */
27
    private static function requires(iterable $files): iterable
28 1
    {
29
        foreach ($files as $file) {
30
            yield from self::require($file);
31 1
        }
32 1
    }
33
34
    /** @return iterable<string, mixed> */
35
    private static function require(string $file): iterable
36
    {
37
        if (strpos($file, '*') !== false) {
38
            $files = glob($file);
39
            if (! is_array($files)) {
40
                return;
41
            }
42
43
            yield from self::requires($files);
44
45
            return;
46
        }
47
48
        /** @phpstan-ignore generator.keyType */
49
        yield from require $file;
50
    }
51
}
52