1: | <?php declare(strict_types=1); |
2: | |
3: | namespace PhpParser\Node\Stmt; |
4: | |
5: | use PhpParser\Modifiers; |
6: | use PhpParser\Node; |
7: | use PhpParser\Node\ComplexType; |
8: | use PhpParser\Node\Identifier; |
9: | use PhpParser\Node\Name; |
10: | use PhpParser\Node\PropertyItem; |
11: | |
12: | class Property extends Node\Stmt { |
13: | |
14: | public int $flags; |
15: | |
16: | public array $props; |
17: | |
18: | public ?Node $type; |
19: | |
20: | public array $attrGroups; |
21: | |
22: | public array $hooks; |
23: | |
24: | |
25: | |
26: | |
27: | |
28: | |
29: | |
30: | |
31: | |
32: | |
33: | |
34: | public function __construct(int $flags, array $props, array $attributes = [], ?Node $type = null, array $attrGroups = [], array $hooks = []) { |
35: | $this->attributes = $attributes; |
36: | $this->flags = $flags; |
37: | $this->props = $props; |
38: | $this->type = $type; |
39: | $this->attrGroups = $attrGroups; |
40: | $this->hooks = $hooks; |
41: | } |
42: | |
43: | public function getSubNodeNames(): array { |
44: | return ['attrGroups', 'flags', 'type', 'props', 'hooks']; |
45: | } |
46: | |
47: | |
48: | |
49: | |
50: | public function isPublic(): bool { |
51: | return ($this->flags & Modifiers::PUBLIC) !== 0 |
52: | || ($this->flags & Modifiers::VISIBILITY_MASK) === 0; |
53: | } |
54: | |
55: | |
56: | |
57: | |
58: | public function isProtected(): bool { |
59: | return (bool) ($this->flags & Modifiers::PROTECTED); |
60: | } |
61: | |
62: | |
63: | |
64: | |
65: | public function isPrivate(): bool { |
66: | return (bool) ($this->flags & Modifiers::PRIVATE); |
67: | } |
68: | |
69: | |
70: | |
71: | |
72: | public function isStatic(): bool { |
73: | return (bool) ($this->flags & Modifiers::STATIC); |
74: | } |
75: | |
76: | |
77: | |
78: | |
79: | public function isReadonly(): bool { |
80: | return (bool) ($this->flags & Modifiers::READONLY); |
81: | } |
82: | |
83: | |
84: | |
85: | |
86: | public function isPublicSet(): bool { |
87: | return (bool) ($this->flags & Modifiers::PUBLIC_SET); |
88: | } |
89: | |
90: | |
91: | |
92: | |
93: | public function isProtectedSet(): bool { |
94: | return (bool) ($this->flags & Modifiers::PROTECTED_SET); |
95: | } |
96: | |
97: | |
98: | |
99: | |
100: | public function isPrivateSet(): bool { |
101: | return (bool) ($this->flags & Modifiers::PRIVATE_SET); |
102: | } |
103: | |
104: | public function getType(): string { |
105: | return 'Stmt_Property'; |
106: | } |
107: | } |
108: | |