| 1: | <?php declare(strict_types = 1); |
| 2: | |
| 3: | namespace PHPStan\Node\Variable; |
| 4: | |
| 5: | use PhpParser\Node; |
| 6: | use PHPStan\Turbo\ReferencedByTurboExtension; |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | #[ReferencedByTurboExtension(key: 'variableWrite')] |
| 17: | final class VariableWrite |
| 18: | { |
| 19: | |
| 20: | public const KIND_ASSIGN = 1; |
| 21: | public const KIND_READ_MODIFY_WRITE = 2; |
| 22: | public const KIND_PRE_INC = 3; |
| 23: | public const KIND_POST_INC = 4; |
| 24: | public const KIND_PRE_DEC = 5; |
| 25: | public const KIND_POST_DEC = 6; |
| 26: | public const KIND_ARRAY_DIM_WRITE = 7; |
| 27: | public const KIND_LIST_ITEM = 8; |
| 28: | public const KIND_FOREACH_VALUE = 9; |
| 29: | public const KIND_FOREACH_KEY = 10; |
| 30: | public const KIND_CATCH = 11; |
| 31: | public const KIND_PARAMETER = 12; |
| 32: | public const KIND_CLOSURE_USE = 13; |
| 33: | public const KIND_ARRAY_LITERAL_ITEM = 14; |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | public function __construct( |
| 40: | private string $variableName, |
| 41: | private Node $node, |
| 42: | private int $id, |
| 43: | private int $kind, |
| 44: | private bool $offsetWrite = false, |
| 45: | private $offset = null, |
| 46: | private ?int $parentId = null, |
| 47: | private bool $replacesOffset = true, |
| 48: | ) |
| 49: | { |
| 50: | } |
| 51: | |
| 52: | public function getVariableName(): string |
| 53: | { |
| 54: | return $this->variableName; |
| 55: | } |
| 56: | |
| 57: | |
| 58: | |
| 59: | |
| 60: | public function getNode(): Node |
| 61: | { |
| 62: | return $this->node; |
| 63: | } |
| 64: | |
| 65: | public function getId(): int |
| 66: | { |
| 67: | return $this->id; |
| 68: | } |
| 69: | |
| 70: | |
| 71: | |
| 72: | |
| 73: | public function getKind(): int |
| 74: | { |
| 75: | return $this->kind; |
| 76: | } |
| 77: | |
| 78: | public function isOffsetWrite(): bool |
| 79: | { |
| 80: | return $this->offsetWrite; |
| 81: | } |
| 82: | |
| 83: | |
| 84: | public function getOffset() |
| 85: | { |
| 86: | return $this->offset; |
| 87: | } |
| 88: | |
| 89: | public function getParentId(): ?int |
| 90: | { |
| 91: | return $this->parentId; |
| 92: | } |
| 93: | |
| 94: | public function replacesOffset(): bool |
| 95: | { |
| 96: | return $this->replacesOffset; |
| 97: | } |
| 98: | |
| 99: | } |
| 100: | |