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