1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\PhpDocParser\Ast\Type; |
4: | |
5: | use PHPStan\PhpDocParser\Ast\NodeAttributes; |
6: | use PHPStan\PhpDocParser\Parser\ParserException; |
7: | |
8: | class InvalidTypeNode implements TypeNode |
9: | { |
10: | |
11: | use NodeAttributes; |
12: | |
13: | |
14: | private $exceptionArgs; |
15: | |
16: | public function __construct(ParserException $exception) |
17: | { |
18: | $this->exceptionArgs = [ |
19: | $exception->getCurrentTokenValue(), |
20: | $exception->getCurrentTokenType(), |
21: | $exception->getCurrentOffset(), |
22: | $exception->getExpectedTokenType(), |
23: | $exception->getExpectedTokenValue(), |
24: | ]; |
25: | } |
26: | |
27: | public function getException(): ParserException |
28: | { |
29: | return new ParserException(...$this->exceptionArgs); |
30: | } |
31: | |
32: | public function __toString(): string |
33: | { |
34: | return '*Invalid type*'; |
35: | } |
36: | |
37: | } |
38: | |