Completed
Push — master ( 0b827a...9f27f3 )
by Jaap
12s queued 11s
created

getDeprecatedDescription()   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 2
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\AttributeNotFound;
17
use PHPStan\Reflection\ClassMemberReflection;
18
use PHPStan\Reflection\ClassReflection;
19
use PHPStan\Reflection\FunctionVariant;
20
use PHPStan\Reflection\MethodReflection;
21
use PHPStan\Reflection\ParametersAcceptor;
22
use PHPStan\Reflection\Php\DummyParameter;
23
use PHPStan\TrinaryLogic;
24
use PHPStan\Type\Generic\TemplateTypeMap;
25
use PHPStan\Type\ObjectType;
26
use PHPStan\Type\Type;
27
28
final class AttributeSetterMethodReflection implements MethodReflection
29
{
30
    /** @var ClassReflection */
31
    private $classReflection;
32
33
    /** @var string */
34
    private $name;
35
    /** @var Type */
36
    private $attributeType;
37
38 2
    public function __construct(ClassReflection $classReflection, string $name, Type $attributeType)
39
    {
40 2
        $this->classReflection = $classReflection;
41 2
        $this->name            = $name;
42 2
        $this->attributeType   = $attributeType;
43 2
    }
44
45
    public function getDeclaringClass() : ClassReflection
46
    {
47
        return $this->classReflection;
48
    }
49
50
    public function isStatic() : bool
51
    {
52
        return false;
53
    }
54
55
    public function isPrivate() : bool
56
    {
57
        return false;
58
    }
59
60
    public function isPublic() : bool
61
    {
62
        return true;
63
    }
64
65
    public function getName() : string
66
    {
67
        return $this->name;
68
    }
69
70
    public function getPrototype() : ClassMemberReflection
71
    {
72
        return $this;
73
    }
74
75
    /**
76
     * @return ParametersAcceptor[]
77
     */
78 2
    public function getVariants() : array
79
    {
80 2
        return [new FunctionVariant(
81 2
            TemplateTypeMap::createEmpty(),
82 2
            TemplateTypeMap::createEmpty(),
83
            [
84 2
                new DummyParameter('value', $this->attributeType, false, null, false, null),
85
            ],
86 2
            false,
87 2
            new ObjectType($this->classReflection->getName())
88
        ),
89
        ];
90
    }
91
92
    public function getDocComment() : ?string
93
    {
94
        return null;
95
    }
96
97
    public function isDeprecated() : TrinaryLogic
98
    {
99
        return TrinaryLogic::createNo();
100
    }
101
102
    public function getDeprecatedDescription() : ?string
103
    {
104
        return null;
105
    }
106
107
    public function isFinal() : TrinaryLogic
108
    {
109
        return TrinaryLogic::createNo();
110
    }
111
112
    public function isInternal() : TrinaryLogic
113
    {
114
        return TrinaryLogic::createNo();
115
    }
116
117
    public function getThrowType() : ?Type
118
    {
119
        return new ObjectType(AttributeNotFound::class);
120
    }
121
122
    public function hasSideEffects() : TrinaryLogic
123
    {
124
        return TrinaryLogic::createYes();
125
    }
126
}
127