ff2f40d2ce6d54987547af36b9722457ba9c6357
[yaffs-website] / vendor / nikic / php-parser / lib / PhpParser / Node / Stmt / ClassConst.php
1 <?php declare(strict_types=1);
2
3 namespace PhpParser\Node\Stmt;
4
5 use PhpParser\Node;
6
7 class ClassConst extends Node\Stmt
8 {
9     /** @var int Modifiers */
10     public $flags;
11     /** @var Node\Const_[] Constant declarations */
12     public $consts;
13
14     /**
15      * Constructs a class const list node.
16      *
17      * @param Node\Const_[] $consts     Constant declarations
18      * @param int           $flags      Modifiers
19      * @param array         $attributes Additional attributes
20      */
21     public function __construct(array $consts, int $flags = 0, array $attributes = []) {
22         parent::__construct($attributes);
23         $this->flags = $flags;
24         $this->consts = $consts;
25     }
26
27     public function getSubNodeNames() : array {
28         return ['flags', 'consts'];
29     }
30
31     /**
32      * Whether constant is explicitly or implicitly public.
33      *
34      * @return bool
35      */
36     public function isPublic() : bool {
37         return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0
38             || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0;
39     }
40
41     /**
42      * Whether constant is protected.
43      *
44      * @return bool
45      */
46     public function isProtected() : bool {
47         return (bool) ($this->flags & Class_::MODIFIER_PROTECTED);
48     }
49
50     /**
51      * Whether constant is private.
52      *
53      * @return bool
54      */
55     public function isPrivate() : bool {
56         return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);
57     }
58     
59     public function getType() : string {
60         return 'Stmt_ClassConst';
61     }
62 }