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: /** @var mixed[] */
14: private array $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: $exception->getCurrentTokenLine(),
25: ];
26: }
27:
28: public function getException(): ParserException
29: {
30: return new ParserException(...$this->exceptionArgs);
31: }
32:
33: public function __toString(): string
34: {
35: return '*Invalid type*';
36: }
37:
38: }
39: