1: <?php
2:
3: declare(strict_types=1);
4:
5: namespace PHPStan\BetterReflection\Reflection\Exception;
6:
7: use PhpParser\Node;
8: use PhpParser\PrettyPrinter\Standard;
9: use RuntimeException;
10:
11: use function sprintf;
12: use function substr;
13:
14: class InvalidConstantNode extends RuntimeException
15: {
16: public static function create(Node $node): self
17: {
18: return new self(sprintf('Invalid constant node (first 50 characters: %s)', substr((new Standard())->prettyPrint([$node]), 0, 50)));
19: }
20: }
21: