We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bd7e350 commit acd8e81Copy full SHA for acd8e81
1 file changed
src/language/php-language.ts
@@ -44,12 +44,25 @@ export class PHPLanguage implements Language {
44
};
45
}
46
47
- const ast = this.#engine.parseCode(file.body, file.path);
+ try {
48
+ const ast = this.#engine.parseCode(file.body, file.path);
49
- return {
50
- ok: true,
51
- ast,
52
- };
+ return {
+ ok: true,
+ ast,
53
+ };
54
+ } catch {
55
56
+ ok: false,
57
+ errors: [
58
+ {
59
+ message: 'File cannot be parsed',
60
+ line: this.lineStart,
61
+ column: this.columnStart,
62
+ },
63
+ ],
64
65
+ }
66
67
68
createSourceCode(file: File, input: OkParseResult<Program>) {
0 commit comments