We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dcffb81 commit b6645faCopy full SHA for b6645fa
routes/web.php
@@ -24,5 +24,11 @@ function hello() {
24
$code = $request->input('code');
25
$parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7);
26
27
- return $parser->parse($code);
+ try {
28
+ return $parser->parse($code);
29
+ } catch (PhpParser\Error $e) {
30
+ return [
31
+ 'error' => $e->getMessage(),
32
+ ];
33
+ }
34
});
0 commit comments