|
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 PHPStan\Reflection\ClassMemberReflection; |
|
17
|
|
|
use PHPStan\Reflection\ClassReflection; |
|
18
|
|
|
use PHPStan\Reflection\FunctionVariant; |
|
19
|
|
|
use PHPStan\Reflection\MethodReflection; |
|
20
|
|
|
use PHPStan\Reflection\ParametersAcceptor; |
|
21
|
|
|
use PHPStan\Reflection\Php\DummyParameter; |
|
22
|
|
|
use PHPStan\Type\ObjectType; |
|
23
|
|
|
use PHPStan\Type\Type; |
|
24
|
|
|
|
|
25
|
|
|
final class AttributeSetterMethodReflection implements MethodReflection |
|
26
|
|
|
{ |
|
27
|
|
|
/** @var ClassReflection */ |
|
28
|
|
|
private $classReflection; |
|
29
|
|
|
|
|
30
|
|
|
/** @var string */ |
|
31
|
|
|
private $name; |
|
32
|
|
|
/** @var Type */ |
|
33
|
|
|
private $attributeType; |
|
34
|
|
|
|
|
35
|
|
|
public function __construct(ClassReflection $classReflection, string $name, Type $attributeType) |
|
36
|
|
|
{ |
|
37
|
|
|
$this->classReflection = $classReflection; |
|
38
|
|
|
$this->name = $name; |
|
39
|
|
|
$this->attributeType = $attributeType; |
|
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
|
|
|
[new DummyParameter('value', $this->attributeType, false)], |
|
79
|
|
|
false, |
|
80
|
|
|
new ObjectType($this->classReflection->getName()) |
|
81
|
|
|
), |
|
82
|
|
|
]; |
|
83
|
|
|
} |
|
84
|
|
|
} |
|
85
|
|
|
|