1: | <?php declare(strict_types=1); |
2: | |
3: | namespace PhpParser\Node\Stmt; |
4: | |
5: | use PhpParser\Modifiers; |
6: | use PhpParser\Node; |
7: | |
8: | class ClassConst extends Node\Stmt { |
9: | |
10: | public int $flags; |
11: | |
12: | public array $consts; |
13: | |
14: | public array $attrGroups; |
15: | |
16: | public ?Node $type; |
17: | |
18: | |
19: | |
20: | |
21: | |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | public function __construct( |
28: | array $consts, |
29: | int $flags = 0, |
30: | array $attributes = [], |
31: | array $attrGroups = [], |
32: | ?Node $type = null |
33: | ) { |
34: | $this->attributes = $attributes; |
35: | $this->flags = $flags; |
36: | $this->consts = $consts; |
37: | $this->attrGroups = $attrGroups; |
38: | $this->type = $type; |
39: | } |
40: | |
41: | public function getSubNodeNames(): array { |
42: | return ['attrGroups', 'flags', 'type', 'consts']; |
43: | } |
44: | |
45: | |
46: | |
47: | |
48: | public function isPublic(): bool { |
49: | return ($this->flags & Modifiers::PUBLIC) !== 0 |
50: | || ($this->flags & Modifiers::VISIBILITY_MASK) === 0; |
51: | } |
52: | |
53: | |
54: | |
55: | |
56: | public function isProtected(): bool { |
57: | return (bool) ($this->flags & Modifiers::PROTECTED); |
58: | } |
59: | |
60: | |
61: | |
62: | |
63: | public function isPrivate(): bool { |
64: | return (bool) ($this->flags & Modifiers::PRIVATE); |
65: | } |
66: | |
67: | |
68: | |
69: | |
70: | public function isFinal(): bool { |
71: | return (bool) ($this->flags & Modifiers::FINAL); |
72: | } |
73: | |
74: | public function getType(): string { |
75: | return 'Stmt_ClassConst'; |
76: | } |
77: | } |
78: | |