Completed
Push — master ( 193431...0b827a )
by Jaap
06:24
created

AttributeGetterMethodReflection::getDocComment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * phpDocumentor
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @link      http://phpdoc.org
12
 */
13
14
namespace phpDocumentor\GraphViz\PHPStan;
15
16
use phpDocumentor\GraphViz\Attribute;
17
use phpDocumentor\GraphViz\AttributeNotFound;
18
use PHPStan\Reflection\ClassMemberReflection;
19
use PHPStan\Reflection\ClassReflection;
20
use PHPStan\Reflection\FunctionVariant;
21
use PHPStan\Reflection\MethodReflection;
22
use PHPStan\Reflection\ParametersAcceptor;
23
use PHPStan\TrinaryLogic;
24
use PHPStan\Type\Generic\TemplateTypeMap;
25
use PHPStan\Type\ObjectType;
26
use PHPStan\Type\Type;
27
28
final class AttributeGetterMethodReflection implements MethodReflection
29
{
30
    /** @var ClassReflection */
31
    private $classReflection;
32
33
    /** @var string */
34
    private $name;
35
36
    public function __construct(ClassReflection $classReflection, string $name)
37
    {
38
        $this->classReflection = $classReflection;
39
        $this->name            = $name;
40
    }
41
42
    public function getDeclaringClass() : ClassReflection
43
    {
44
        return $this->classReflection;
45
    }
46
47
    public function isStatic() : bool
48
    {
49
        return false;
50
    }
51
52
    public function isPrivate() : bool
53
    {
54
        return false;
55
    }
56
57
    public function isPublic() : bool
58
    {
59
        return true;
60
    }
61
62
    public function getName() : string
63
    {
64
        return $this->name;
65
    }
66
67
    public function getPrototype() : ClassMemberReflection
68
    {
69
        return $this;
70
    }
71
72
    /**
73
     * @return ParametersAcceptor[]
74
     */
75
    public function getVariants() : array
76
    {
77
        return [new FunctionVariant(
78
            TemplateTypeMap::createEmpty(),
79
            null,
80
            [],
81
            false,
82
            new ObjectType(Attribute::class)
83
        ),
84
        ];
85
    }
86
87
    public function getDocComment() : ?string
88
    {
89
        return null;
90
    }
91
92
    public function isDeprecated() : TrinaryLogic
93
    {
94
        return TrinaryLogic::createNo();
95
    }
96
97
    public function getDeprecatedDescription() : ?string
98
    {
99
        return null;
100
    }
101
102
    public function isFinal() : TrinaryLogic
103
    {
104
        return TrinaryLogic::createNo();
105
    }
106
107
    public function isInternal() : TrinaryLogic
108
    {
109
        return TrinaryLogic::createNo();
110
    }
111
112
    public function getThrowType() : ?Type
113
    {
114
        return new ObjectType(AttributeNotFound::class);
115
    }
116
117
    public function hasSideEffects() : TrinaryLogic
118
    {
119
        return TrinaryLogic::createMaybe();
120
    }
121
}
122