Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 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
    /** @var Node\AttributeGroup[] */
14
    public $attrGroups;
15
 
16
    /**
17
     * Constructs a class const list node.
18
     *
19
     * @param Node\Const_[]         $consts     Constant declarations
20
     * @param int                   $flags      Modifiers
21
     * @param array                 $attributes Additional attributes
22
     * @param Node\AttributeGroup[] $attrGroups PHP attribute groups
23
     */
24
    public function __construct(
25
        array $consts,
26
        int $flags = 0,
27
        array $attributes = [],
28
        array $attrGroups = []
29
    ) {
30
        $this->attributes = $attributes;
31
        $this->flags = $flags;
32
        $this->consts = $consts;
33
        $this->attrGroups = $attrGroups;
34
    }
35
 
36
    public function getSubNodeNames() : array {
37
        return ['attrGroups', 'flags', 'consts'];
38
    }
39
 
40
    /**
41
     * Whether constant is explicitly or implicitly public.
42
     *
43
     * @return bool
44
     */
45
    public function isPublic() : bool {
46
        return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0
47
            || ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0;
48
    }
49
 
50
    /**
51
     * Whether constant is protected.
52
     *
53
     * @return bool
54
     */
55
    public function isProtected() : bool {
56
        return (bool) ($this->flags & Class_::MODIFIER_PROTECTED);
57
    }
58
 
59
    /**
60
     * Whether constant is private.
61
     *
62
     * @return bool
63
     */
64
    public function isPrivate() : bool {
65
        return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);
66
    }
67
 
68
    /**
69
     * Whether constant is final.
70
     *
71
     * @return bool
72
     */
73
    public function isFinal() : bool {
74
        return (bool) ($this->flags & Class_::MODIFIER_FINAL);
75
    }
76
 
77
    public function getType() : string {
78
        return 'Stmt_ClassConst';
79
    }
80
}