| 1: | <?php declare(strict_types=1); |
| 2: | |
| 3: | namespace PhpParser\Node; |
| 4: | |
| 5: | use PhpParser\Modifiers; |
| 6: | use PhpParser\Node; |
| 7: | use PhpParser\NodeAbstract; |
| 8: | |
| 9: | class Param extends NodeAbstract { |
| 10: | |
| 11: | public ?Node $type; |
| 12: | |
| 13: | public bool $byRef; |
| 14: | |
| 15: | public bool $variadic; |
| 16: | |
| 17: | public Expr $var; |
| 18: | |
| 19: | public ?Expr $default; |
| 20: | |
| 21: | public int $flags; |
| 22: | |
| 23: | public array $attrGroups; |
| 24: | |
| 25: | public array $hooks; |
| 26: | |
| 27: | |
| 28: | |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | public function __construct( |
| 41: | Expr $var, ?Expr $default = null, ?Node $type = null, |
| 42: | bool $byRef = false, bool $variadic = false, |
| 43: | array $attributes = [], |
| 44: | int $flags = 0, |
| 45: | array $attrGroups = [], |
| 46: | array $hooks = [] |
| 47: | ) { |
| 48: | $this->attributes = $attributes; |
| 49: | $this->type = $type; |
| 50: | $this->byRef = $byRef; |
| 51: | $this->variadic = $variadic; |
| 52: | $this->var = $var; |
| 53: | $this->default = $default; |
| 54: | $this->flags = $flags; |
| 55: | $this->attrGroups = $attrGroups; |
| 56: | $this->hooks = $hooks; |
| 57: | } |
| 58: | |
| 59: | public function getSubNodeNames(): array { |
| 60: | return ['attrGroups', 'flags', 'type', 'byRef', 'variadic', 'var', 'default', 'hooks']; |
| 61: | } |
| 62: | |
| 63: | public function getType(): string { |
| 64: | return 'Param'; |
| 65: | } |
| 66: | |
| 67: | |
| 68: | |
| 69: | |
| 70: | public function isPromoted(): bool { |
| 71: | return $this->flags !== 0; |
| 72: | } |
| 73: | |
| 74: | public function isPublic(): bool { |
| 75: | return (bool) ($this->flags & Modifiers::PUBLIC); |
| 76: | } |
| 77: | |
| 78: | public function isProtected(): bool { |
| 79: | return (bool) ($this->flags & Modifiers::PROTECTED); |
| 80: | } |
| 81: | |
| 82: | public function isPrivate(): bool { |
| 83: | return (bool) ($this->flags & Modifiers::PRIVATE); |
| 84: | } |
| 85: | |
| 86: | public function isReadonly(): bool { |
| 87: | return (bool) ($this->flags & Modifiers::READONLY); |
| 88: | } |
| 89: | |
| 90: | |
| 91: | |
| 92: | |
| 93: | public function isPublicSet(): bool { |
| 94: | return (bool) ($this->flags & Modifiers::PUBLIC_SET); |
| 95: | } |
| 96: | |
| 97: | |
| 98: | |
| 99: | |
| 100: | public function isProtectedSet(): bool { |
| 101: | return (bool) ($this->flags & Modifiers::PROTECTED_SET); |
| 102: | } |
| 103: | |
| 104: | |
| 105: | |
| 106: | |
| 107: | public function isPrivateSet(): bool { |
| 108: | return (bool) ($this->flags & Modifiers::PRIVATE_SET); |
| 109: | } |
| 110: | } |
| 111: | |