1 <?php declare(strict_types=1);
3 namespace PhpParser\Node\Stmt;
7 class ClassConst extends Node\Stmt
9 /** @var int Modifiers */
11 /** @var Node\Const_[] Constant declarations */
15 * Constructs a class const list node.
17 * @param Node\Const_[] $consts Constant declarations
18 * @param int $flags Modifiers
19 * @param array $attributes Additional attributes
21 public function __construct(array $consts, int $flags = 0, array $attributes = []) {
22 parent::__construct($attributes);
23 $this->flags = $flags;
24 $this->consts = $consts;
27 public function getSubNodeNames() : array {
28 return ['flags', 'consts'];
32 * Whether constant is explicitly or implicitly public.
36 public function isPublic() : bool {
37 return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0
38 || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0;
42 * Whether constant is protected.
46 public function isProtected() : bool {
47 return (bool) ($this->flags & Class_::MODIFIER_PROTECTED);
51 * Whether constant is private.
55 public function isPrivate() : bool {
56 return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);
59 public function getType() : string {
60 return 'Stmt_ClassConst';