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