Passed
Push — master ( f70274...15da4f )
by Константин
08:58
created

EnumMethodReflection::getVariants()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Grachevko\Enum\PHPStan;
4
5
use Grachevko\Enum\Utils;
6
use PHPStan\Reflection\ClassMemberReflection;
7
use PHPStan\Reflection\ClassReflection;
8
use PHPStan\Reflection\MethodReflection;
9
10
/**
11
 * @author Konstantin Grachev <[email protected]>
12
 */
13
final class EnumMethodReflection implements MethodReflection
14
{
15
    /**
16
     * @var ClassReflection
17
     */
18
    private $classReflection;
19
20
    /**
21
     * @var string
22
     */
23
    private $name;
24
25
    public function __construct(ClassReflection $classReflection, string $methodName)
26
    {
27
        $this->classReflection = $classReflection;
28
        $this->name = $methodName;
29
    }
30
31
    public function getVariants(): array
32
    {
33
        return [];
34
    }
35
36
    public function getDeclaringClass(): ClassReflection
37
    {
38
        return $this->classReflection;
39
    }
40
41
    public function isStatic(): bool
42
    {
43
        return $this->classReflection->getNativeReflection()->hasConstant(Utils::stringToConstant($this->name));
44
    }
45
46
    public function isPrivate(): bool
47
    {
48
        return false;
49
    }
50
51
    public function isPublic(): bool
52
    {
53
        return true;
54
    }
55
56
    public function getPrototype(): ClassMemberReflection
57
    {
58
        return $this;
59
    }
60
61
    public function getName(): string
62
    {
63
        return $this->name;
64
    }
65
}
66