Skip to content

Commit 7973054

Browse files
committed
Keep linebreaks after comments
Concatenating line terminated comments will change the query. Signed-off-by: Michal Čihař <michal@cihar.com>
1 parent 3fb0cf7 commit 7973054

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Utils/Formatter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ public function formatList($list)
340340
$curr = $list->tokens[$list->idx];
341341

342342
if ($curr->type === Token::TYPE_WHITESPACE) {
343+
// Keep linebreaks after comments
344+
if (strpos($curr->token, "\n") !== false && $prev !== null && $prev->type === Token::TYPE_COMMENT) {
345+
$lineEnded = true;
346+
}
343347
// Whitespaces are skipped because the formatter adds its own.
344348
continue;
345349
}

0 commit comments

Comments
 (0)