Token.php 487 B

123456789101112131415161718
  1. <?php declare(strict_types=1);
  2. namespace PhpParser;
  3. /**
  4. * A PHP token. On PHP 8.0 this extends from PhpToken.
  5. */
  6. class Token extends Internal\TokenPolyfill {
  7. /** Get (exclusive) zero-based end position of the token. */
  8. public function getEndPos(): int {
  9. return $this->pos + \strlen($this->text);
  10. }
  11. /** Get 1-based end line number of the token. */
  12. public function getEndLine(): int {
  13. return $this->line + \substr_count($this->text, "\n");
  14. }
  15. }