Skip to content

Commit 90b5d69

Browse files
committed
Symbol: add isUsed property
This adds the isUsed property to Symbol so it can be used in place of `ImportedSymbol` for symbols in an import statement.
1 parent 60ad44d commit 90b5d69

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ImportDetection/Symbol.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
class Symbol {
77
private $tokens;
8+
private $isUsed;
89

910
public function __construct(array $tokens) {
1011
if (empty($tokens)) {
@@ -16,6 +17,7 @@ public function __construct(array $tokens) {
1617
}
1718
}
1819
$this->tokens = $tokens;
20+
$this->isUsed = false;
1921
}
2022

2123
public static function getTokenWithPosition(array $token, int $stackPtr): array {
@@ -51,6 +53,14 @@ public function getSymbolPosition(): int {
5153
return $this->tokens[0]['tokenPosition'] ?? 1;
5254
}
5355

56+
public function markUsed() {
57+
$this->isUsed = true;
58+
}
59+
60+
public function isUsed(): bool {
61+
return $this->isUsed;
62+
}
63+
5464
private function joinSymbolParts(array $tokens): string {
5565
$symbolStrings = array_map(function (array $token): string {
5666
return $token['content'] ?? '';

0 commit comments

Comments
 (0)