File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/Propel/Generator/Util Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -239,17 +239,21 @@ public function getNextStatement(): string
239239 $ lowercaseString = '' ; // helper variable for performance sake
240240 while ($ this ->pos <= $ this ->len ) {
241241 $ char = $ this ->sql [$ this ->pos ] ?? '' ;
242- if ($ isCommentLine === true && $ char !== "\n" ) {
242+ // Skip comments
243+ if ($ isCommentLine === true && $ char !== PHP_EOL ) {
243244 $ this ->pos ++;
244245
245246 continue ;
246247 }
247248 // check flags for strings or escaper
248249 switch ($ char ) {
249250 case '# ' :
250- $ isCommentLine = true ;
251+ // detect comment line
252+ if ($ this ->sql [$ this ->pos --] === PHP_EOL ) {
253+ $ isCommentLine = true ;
251254
252- continue 2 ;
255+ continue 2 ;
256+ }
253257 case "\n" :
254258 if ($ isCommentLine === true ) {
255259 $ isCommentLine = false ;
@@ -313,7 +317,7 @@ public function getNextStatement(): string
313317 $ this ->pos += $ i ; // increase position
314318 $ parsedTrimmedString = trim ($ parsedString );
315319
316- return $ parsedTrimmedString ? $ parsedTrimmedString : $ parsedString ; // empty line
320+ return $ parsedTrimmedString ?: $ parsedString ; // to check empty line to avoid stop parsing
317321 }
318322 // avoid using strtolower on the whole parsed string every time new character is added
319323 // there is also no point in adding characters which are in the string
You can’t perform that action at this time.
0 commit comments