-
Notifications
You must be signed in to change notification settings - Fork 426
/
ClassPropertyNode.php
101 lines (83 loc) · 1.77 KB
/
ClassPropertyNode.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php declare(strict_types = 1);
namespace PHPStan\Node;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Class_;
use PhpParser\NodeAbstract;
/** @api */
class ClassPropertyNode extends NodeAbstract implements VirtualNode
{
public function __construct(
private string $name,
private int $flags,
private Identifier|Name|Node\ComplexType|null $type,
private ?Expr $default,
private ?string $phpDoc,
private bool $isPromoted,
Node $originalNode,
)
{
parent::__construct($originalNode->getAttributes());
}
public function getName(): string
{
return $this->name;
}
public function getFlags(): int
{
return $this->flags;
}
public function getDefault(): ?Expr
{
return $this->default;
}
public function isPromoted(): bool
{
return $this->isPromoted;
}
public function getPhpDoc(): ?string
{
return $this->phpDoc;
}
public function isPublic(): bool
{
return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0
|| ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0;
}
public function isProtected(): bool
{
return (bool) ($this->flags & Class_::MODIFIER_PROTECTED);
}
public function isPrivate(): bool
{
return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);
}
public function isStatic(): bool
{
return (bool) ($this->flags & Class_::MODIFIER_STATIC);
}
public function isReadOnly(): bool
{
return (bool) ($this->flags & Class_::MODIFIER_READONLY);
}
/**
* @return Identifier|Name|Node\ComplexType|null
*/
public function getNativeType()
{
return $this->type;
}
public function getType(): string
{
return 'PHPStan_Node_ClassPropertyNode';
}
/**
* @return string[]
*/
public function getSubNodeNames(): array
{
return [];
}
}