File tree Expand file tree Collapse file tree 1 file changed +29
-4
lines changed Expand file tree Collapse file tree 1 file changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,16 @@ public function hasSyntaxError()
47
47
public function getSyntaxError ()
48
48
{
49
49
if ($ this ->hasSyntaxError ()) {
50
+ // Look for fatal errors first
50
51
foreach (explode ("\n" , $ this ->getOutput ()) as $ line ) {
51
- if ($ this ->containsParserOrFatalError ($ line )) {
52
+ if ($ this ->containsFatalError ($ line )) {
53
+ return $ line ;
54
+ }
55
+ }
56
+
57
+ // Look for parser errors second
58
+ foreach (explode ("\n" , $ this ->getOutput ()) as $ line ) {
59
+ if ($ this ->containsParserError ($ line )) {
52
60
return $ line ;
53
61
}
54
62
}
@@ -81,7 +89,24 @@ public function isSuccess()
81
89
*/
82
90
private function containsParserOrFatalError ($ string )
83
91
{
84
- return strpos ($ string , self ::FATAL_ERROR ) !== false ||
85
- strpos ($ string , self ::PARSE_ERROR ) !== false ;
92
+ return $ this ->containsParserError ($ string ) || $ this ->containsFatalError ($ string );
93
+ }
94
+
95
+ /**
96
+ * @param $string
97
+ * @return bool
98
+ */
99
+ private function containsParserError ($ string )
100
+ {
101
+ return strpos ($ string , self ::PARSE_ERROR ) !== false ;
102
+ }
103
+
104
+ /**
105
+ * @param $string
106
+ * @return bool
107
+ */
108
+ private function containsFatalError ($ string )
109
+ {
110
+ return strpos ($ string , self ::FATAL_ERROR ) !== false ;
86
111
}
87
- }
112
+ }
You can’t perform that action at this time.
0 commit comments