Passed
Pull Request — master (#38)
by Sergei
05:23 queued 02:36
created

TokenizerClassifier   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAvailableDeclarations() 0 11 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Classifier;
6
7
/**
8
 * `TokenizerClassifier` is a classifier that finds classes, interfaces, traits and enums using PHP tokenizer.
9
 */
10
final class TokenizerClassifier extends AbstractClassifier
11
{
12
    /**
13
     * @psalm-suppress UnresolvableInclude
14
     *
15
     * @return array<array-key, class-string|trait-string>
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<array-key, class-string|trait-string> at position 2 could not be parsed: Unknown type name 'array-key' at position 2 in array<array-key, class-string|trait-string>.
Loading history...
16
     */
17 17
    protected function getAvailableDeclarations(): iterable
18
    {
19 17
        $files = $this->getFiles();
20 17
        $declarations = [];
21
22 17
        foreach ($files as $file) {
23 17
            $reflectionFile = new ReflectionFile($file->getPathname());
24 17
            array_push($declarations, ...$reflectionFile->getDeclarations());
25
        }
26
27 17
        return $declarations;
28
    }
29
}
30