File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,8 @@ public static function renderLatteError(?\Throwable $e): ?array
49
49
];
50
50
51
51
} elseif ($ e && strpos ($ file = $ e ->getFile (), '.latte-- ' )) {
52
- $ lines = file ($ file );
53
- if (preg_match ('#// source: (\S+\.latte)# ' , $ lines [1 ], $ m ) && @is_file ($ m [1 ])) { // @ - may trigger error
52
+ $ lines = file ($ file, FILE_IGNORE_NEW_LINES );
53
+ if (preg_match ('#/(?:/|\*\*) source: (\S+\.latte)# ' , $ lines [1 ] ?: $ lines [ 4 ], $ m ) && @is_file ($ m [1 ])) { // @ - may trigger error
54
54
$ templateFile = $ m [1 ];
55
55
$ templateLine = $ e ->getLine () && preg_match ('#/\* line (\d+) \*/# ' , $ lines [$ e ->getLine () - 1 ], $ m ) ? (int ) $ m [1 ] : 0 ;
56
56
return [
@@ -71,7 +71,7 @@ public static function renderLatteUnknownMacro(?\Throwable $e): ?array
71
71
if (
72
72
$ e instanceof Latte \CompileException
73
73
&& @is_file ($ e ->sourceName ) // @ - may trigger error
74
- && (preg_match ('#Unknown macro (\{\w+)\}, did you mean (\{\w+)\}\?#A ' , $ e ->getMessage (), $ m )
74
+ && (preg_match ('#Unknown (?: macro|tag) (\{\w+)\}, did you mean (\{\w+)\}\?#A ' , $ e ->getMessage (), $ m )
75
75
|| preg_match ('#Unknown attribute (n:\w+), did you mean (n:\w+)\?#A ' , $ e ->getMessage (), $ m ))
76
76
) {
77
77
return [
You can’t perform that action at this time.
0 commit comments