Skip to content

Commit

Permalink
Keep linebreaks after comments
Browse files Browse the repository at this point in the history
Concatenating line terminated comments will change the query.

Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Apr 4, 2017
1 parent 3fb0cf7 commit 7973054
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Utils/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,10 @@ public function formatList($list)
$curr = $list->tokens[$list->idx];

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

0 comments on commit 7973054

Please sign in to comment.