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 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\Type\ObjectType; |
23
|
|
|
|
24
|
|
|
final class AttributeGetterMethodReflection implements MethodReflection |
25
|
|
|
{ |
26
|
|
|
/** @var ClassReflection */ |
27
|
|
|
private $classReflection; |
28
|
|
|
|
29
|
|
|
/** @var string */ |
30
|
|
|
private $name; |
31
|
|
|
|
32
|
|
|
public function __construct(ClassReflection $classReflection, string $name) |
33
|
|
|
{ |
34
|
|
|
$this->classReflection = $classReflection; |
35
|
|
|
$this->name = $name; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function getDeclaringClass() : ClassReflection |
39
|
|
|
{ |
40
|
|
|
return $this->classReflection; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function isStatic() : bool |
44
|
|
|
{ |
45
|
|
|
return false; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function isPrivate() : bool |
49
|
|
|
{ |
50
|
|
|
return false; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function isPublic() : bool |
54
|
|
|
{ |
55
|
|
|
return true; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function getName() : string |
59
|
|
|
{ |
60
|
|
|
return $this->name; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function getPrototype() : ClassMemberReflection |
64
|
|
|
{ |
65
|
|
|
return $this; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return ParametersAcceptor[] |
70
|
|
|
*/ |
71
|
|
|
public function getVariants() : array |
72
|
|
|
{ |
73
|
|
|
return [new FunctionVariant( |
74
|
|
|
[], |
75
|
|
|
false, |
76
|
|
|
new ObjectType(Attribute::class) |
77
|
|
|
), |
78
|
|
|
]; |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|