| @@ -25,9 +25,9 @@ | ||
| 25 | 25 | * @var string |
| 26 | 26 | */ |
| 27 | 27 | public $text; |
| 28 | 28 | /** |
| 29 | - * @var int | |
| 29 | + * @var -1|positive-int | |
| 30 | 30 | */ |
| 31 | 31 | public $line; |
| 32 | 32 | /** |
| 33 | 33 | * @var int |
| @@ -32,8 +32,11 @@ | ||
| 32 | 32 | /** |
| 33 | 33 | * @var int |
| 34 | 34 | */ |
| 35 | 35 | public $pos; |
| 36 | + /** | |
| 37 | + * @param -1|positive-int $line | |
| 38 | + */ | |
| 36 | 39 | public function __construct(int $id, string $text, int $line = -1, int $position = -1) |
| 37 | 40 | { |
| 38 | 41 | $this->id = $id; |
| 39 | 42 | $this->text = $text; |
| @@ -42,9 +45,9 @@ | ||
| 42 | 45 | } |
| 43 | 46 | public function getTokenName(): ?string |
| 44 | 47 | { |
| 45 | 48 | if ('UNKNOWN' === $name = token_name($this->id)) { |
| 46 | - $name = (\strlen($this->text) > 1 || \ord($this->text) < 32) ? null : $this->text; | |
| 49 | + $name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text; | |
| 47 | 50 | } |
| 48 | 51 | return $name; |
| 49 | 52 | } |
| 50 | 53 | /** |
| @@ -67,9 +70,9 @@ | ||
| 67 | 70 | { |
| 68 | 71 | return (string) $this->text; |
| 69 | 72 | } |
| 70 | 73 | /** |
| 71 | - * @return static[] | |
| 74 | + * @return list<static> | |
| 72 | 75 | */ |
| 73 | 76 | public static function tokenize(string $code, int $flags = 0): array |
| 74 | 77 | { |
| 75 | 78 | $line = 1; |