|   1:  | <?php declare(strict_types = 1); | 
|   2:  |  | 
|   3:  | namespace PHPStan\Node; | 
|   4:  |  | 
|   5:  | use PhpParser\Node; | 
|   6:  | use PhpParser\Node\Expr; | 
|   7:  | use PhpParser\Node\Identifier; | 
|   8:  | use PhpParser\Node\Name; | 
|   9:  | use PhpParser\Node\Stmt\Class_; | 
|  10:  | use PhpParser\NodeAbstract; | 
|  11:  | use PHPStan\Type\Type; | 
|  12:  |  | 
|  13:  |  | 
|  14:  | class ClassPropertyNode extends NodeAbstract implements VirtualNode | 
|  15:  | { | 
|  16:  |  | 
|  17:  | 	public function __construct( | 
|  18:  | 		private string $name, | 
|  19:  | 		private int $flags, | 
|  20:  | 		private Identifier|Name|Node\ComplexType|null $type, | 
|  21:  | 		private ?Expr $default, | 
|  22:  | 		private ?string $phpDoc, | 
|  23:  | 		private ?Type $phpDocType, | 
|  24:  | 		private bool $isPromoted, | 
|  25:  | 		Node $originalNode, | 
|  26:  | 		private bool $isReadonlyByPhpDoc, | 
|  27:  | 		private bool $isDeclaredInTrait, | 
|  28:  | 		private bool $isReadonlyClass, | 
|  29:  | 	) | 
|  30:  | 	{ | 
|  31:  | 		parent::__construct($originalNode->getAttributes()); | 
|  32:  | 	} | 
|  33:  |  | 
|  34:  | 	public function getName(): string | 
|  35:  | 	{ | 
|  36:  | 		return $this->name; | 
|  37:  | 	} | 
|  38:  |  | 
|  39:  | 	public function getFlags(): int | 
|  40:  | 	{ | 
|  41:  | 		return $this->flags; | 
|  42:  | 	} | 
|  43:  |  | 
|  44:  | 	public function getDefault(): ?Expr | 
|  45:  | 	{ | 
|  46:  | 		return $this->default; | 
|  47:  | 	} | 
|  48:  |  | 
|  49:  | 	public function isPromoted(): bool | 
|  50:  | 	{ | 
|  51:  | 		return $this->isPromoted; | 
|  52:  | 	} | 
|  53:  |  | 
|  54:  | 	public function getPhpDoc(): ?string | 
|  55:  | 	{ | 
|  56:  | 		return $this->phpDoc; | 
|  57:  | 	} | 
|  58:  |  | 
|  59:  | 	public function getPhpDocType(): ?Type | 
|  60:  | 	{ | 
|  61:  | 		return $this->phpDocType; | 
|  62:  | 	} | 
|  63:  |  | 
|  64:  | 	public function isPublic(): bool | 
|  65:  | 	{ | 
|  66:  | 		return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0 | 
|  67:  | 			|| ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0; | 
|  68:  | 	} | 
|  69:  |  | 
|  70:  | 	public function isProtected(): bool | 
|  71:  | 	{ | 
|  72:  | 		return (bool) ($this->flags & Class_::MODIFIER_PROTECTED); | 
|  73:  | 	} | 
|  74:  |  | 
|  75:  | 	public function isPrivate(): bool | 
|  76:  | 	{ | 
|  77:  | 		return (bool) ($this->flags & Class_::MODIFIER_PRIVATE); | 
|  78:  | 	} | 
|  79:  |  | 
|  80:  | 	public function isStatic(): bool | 
|  81:  | 	{ | 
|  82:  | 		return (bool) ($this->flags & Class_::MODIFIER_STATIC); | 
|  83:  | 	} | 
|  84:  |  | 
|  85:  | 	public function isReadOnly(): bool | 
|  86:  | 	{ | 
|  87:  | 		return (bool) ($this->flags & Class_::MODIFIER_READONLY) || $this->isReadonlyClass; | 
|  88:  | 	} | 
|  89:  |  | 
|  90:  | 	public function isReadOnlyByPhpDoc(): bool | 
|  91:  | 	{ | 
|  92:  | 		return $this->isReadonlyByPhpDoc; | 
|  93:  | 	} | 
|  94:  |  | 
|  95:  | 	public function isDeclaredInTrait(): bool | 
|  96:  | 	{ | 
|  97:  | 		return $this->isDeclaredInTrait; | 
|  98:  | 	} | 
|  99:  |  | 
| 100:  | 	 | 
| 101:  |  | 
| 102:  |  | 
| 103:  | 	public function getNativeType() | 
| 104:  | 	{ | 
| 105:  | 		return $this->type; | 
| 106:  | 	} | 
| 107:  |  | 
| 108:  | 	public function getType(): string | 
| 109:  | 	{ | 
| 110:  | 		return 'PHPStan_Node_ClassPropertyNode'; | 
| 111:  | 	} | 
| 112:  |  | 
| 113:  | 	 | 
| 114:  |  | 
| 115:  |  | 
| 116:  | 	public function getSubNodeNames(): array | 
| 117:  | 	{ | 
| 118:  | 		return []; | 
| 119:  | 	} | 
| 120:  |  | 
| 121:  | } | 
| 122:  |  |