class ParserException
Same name in this branch
- 11.1.x vendor/phpunit/php-code-coverage/src/Exception/ParserException.php \SebastianBergmann\CodeCoverage\ParserException
Hierarchy
- class \PHPStan\PhpDocParser\Parser\ParserException extends \Exception
Expanded class hierarchy of ParserException
4 files declare their use of ParserException
- DocCommentHelper.php in vendor/
slevomat/ coding-standard/ SlevomatCodingStandard/ Helpers/ DocCommentHelper.php - InvalidTagValueNode.php in vendor/
phpstan/ phpdoc-parser/ src/ Ast/ PhpDoc/ InvalidTagValueNode.php - InvalidTypeNode.php in vendor/
phpstan/ phpdoc-parser/ src/ Ast/ Type/ InvalidTypeNode.php - TypeResolver.php in vendor/
phpdocumentor/ type-resolver/ src/ TypeResolver.php
File
-
vendor/
phpstan/ phpdoc-parser/ src/ Parser/ ParserException.php, line 14
Namespace
PHPStan\PhpDocParser\ParserView source
class ParserException extends Exception {
/** @var string */
private $currentTokenValue;
/** @var int */
private $currentTokenType;
/** @var int */
private $currentOffset;
/** @var int */
private $expectedTokenType;
/** @var string|null */
private $expectedTokenValue;
/** @var int|null */
private $currentTokenLine;
public function __construct(string $currentTokenValue, int $currentTokenType, int $currentOffset, int $expectedTokenType, ?string $expectedTokenValue = null, ?int $currentTokenLine = null) {
$this->currentTokenValue = $currentTokenValue;
$this->currentTokenType = $currentTokenType;
$this->currentOffset = $currentOffset;
$this->expectedTokenType = $expectedTokenType;
$this->expectedTokenValue = $expectedTokenValue;
$this->currentTokenLine = $currentTokenLine;
parent::__construct(sprintf('Unexpected token %s, expected %s%s at offset %d%s', $this->formatValue($currentTokenValue), Lexer::TOKEN_LABELS[$expectedTokenType], $expectedTokenValue !== null ? sprintf(' (%s)', $this->formatValue($expectedTokenValue)) : '', $currentOffset, $currentTokenLine === null ? '' : sprintf(' on line %d', $currentTokenLine)));
}
public function getCurrentTokenValue() : string {
return $this->currentTokenValue;
}
public function getCurrentTokenType() : int {
return $this->currentTokenType;
}
public function getCurrentOffset() : int {
return $this->currentOffset;
}
public function getExpectedTokenType() : int {
return $this->expectedTokenType;
}
public function getExpectedTokenValue() : ?string {
return $this->expectedTokenValue;
}
public function getCurrentTokenLine() : ?int {
return $this->currentTokenLine;
}
private function formatValue(string $value) : string {
$json = json_encode($value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_SUBSTITUTE);
assert($json !== false);
return $json;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ParserException::$currentOffset | private | property | @var int |
ParserException::$currentTokenLine | private | property | @var int|null |
ParserException::$currentTokenType | private | property | @var int |
ParserException::$currentTokenValue | private | property | @var string |
ParserException::$expectedTokenType | private | property | @var int |
ParserException::$expectedTokenValue | private | property | @var string|null |
ParserException::formatValue | private | function | |
ParserException::getCurrentOffset | public | function | |
ParserException::getCurrentTokenLine | public | function | |
ParserException::getCurrentTokenType | public | function | |
ParserException::getCurrentTokenValue | public | function | |
ParserException::getExpectedTokenType | public | function | |
ParserException::getExpectedTokenValue | public | function | |
ParserException::__construct | public | function |