1: | <?php declare(strict_types=1); |
2: | |
3: | namespace PhpParser\Node\Stmt; |
4: | |
5: | use PhpParser\Node; |
6: | use PhpParser\Node\ComplexType; |
7: | use PhpParser\Node\Identifier; |
8: | use PhpParser\Node\Name; |
9: | |
10: | class Property extends Node\Stmt |
11: | { |
12: | |
13: | public $flags; |
14: | |
15: | public $props; |
16: | |
17: | public $type; |
18: | |
19: | public $attrGroups; |
20: | |
21: | |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | |
28: | |
29: | |
30: | public function __construct(int $flags, array $props, array $attributes = [], $type = null, array $attrGroups = []) { |
31: | $this->attributes = $attributes; |
32: | $this->flags = $flags; |
33: | $this->props = $props; |
34: | $this->type = \is_string($type) ? new Identifier($type) : $type; |
35: | $this->attrGroups = $attrGroups; |
36: | } |
37: | |
38: | public function getSubNodeNames() : array { |
39: | return ['attrGroups', 'flags', 'type', 'props']; |
40: | } |
41: | |
42: | |
43: | |
44: | |
45: | |
46: | |
47: | public function isPublic() : bool { |
48: | return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0 |
49: | || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0; |
50: | } |
51: | |
52: | |
53: | |
54: | |
55: | |
56: | |
57: | public function isProtected() : bool { |
58: | return (bool) ($this->flags & Class_::MODIFIER_PROTECTED); |
59: | } |
60: | |
61: | |
62: | |
63: | |
64: | |
65: | |
66: | public function isPrivate() : bool { |
67: | return (bool) ($this->flags & Class_::MODIFIER_PRIVATE); |
68: | } |
69: | |
70: | |
71: | |
72: | |
73: | |
74: | |
75: | public function isStatic() : bool { |
76: | return (bool) ($this->flags & Class_::MODIFIER_STATIC); |
77: | } |
78: | |
79: | |
80: | |
81: | |
82: | |
83: | |
84: | public function isReadonly() : bool { |
85: | return (bool) ($this->flags & Class_::MODIFIER_READONLY); |
86: | } |
87: | |
88: | public function getType() : string { |
89: | return 'Stmt_Property'; |
90: | } |
91: | } |
92: | |