| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace PHPStan\BetterReflection\Reflection\Exception; |
| 6: | |
| 7: | use PhpParser\Node; |
| 8: | use PHPStan\BetterReflection\BetterReflection; |
| 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: | $printer = (new BetterReflection())->printer(); |
| 19: | return new self(sprintf('Invalid constant node (first 50 characters: %s)', substr($printer->prettyPrint([$node]), 0, 50))); |
| 20: | } |
| 21: | } |
| 22: | |