1 <?php declare(strict_types=1);
3 namespace PhpParser\Node\Stmt;
7 class Property extends Node\Stmt
9 /** @var int Modifiers */
11 /** @var PropertyProperty[] Properties */
15 * Constructs a class property list node.
17 * @param int $flags Modifiers
18 * @param PropertyProperty[] $props Properties
19 * @param array $attributes Additional attributes
21 public function __construct(int $flags, array $props, array $attributes = []) {
22 parent::__construct($attributes);
23 $this->flags = $flags;
24 $this->props = $props;
27 public function getSubNodeNames() : array {
28 return ['flags', 'props'];
32 * Whether the property 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 the property is protected.
46 public function isProtected() : bool {
47 return (bool) ($this->flags & Class_::MODIFIER_PROTECTED);
51 * Whether the property is private.
55 public function isPrivate() : bool {
56 return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);
60 * Whether the property is static.
64 public function isStatic() : bool {
65 return (bool) ($this->flags & Class_::MODIFIER_STATIC);
68 public function getType() : string {
69 return 'Stmt_Property';