Skip to content

Commit

Permalink
minor #36689 [Yaml] properly handle empty lines (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Yaml] properly handle empty lines

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

e91bb61 properly handle empty lines
  • Loading branch information
nicolas-grekas committed May 4, 2020
2 parents ca1d4b4 + e91bb61 commit 6852327
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Yaml/Parser.php
Expand Up @@ -969,7 +969,7 @@ private function isCurrentLineBlank(): bool
private function isCurrentLineComment(): bool
{
//checking explicitly the first char of the trim is faster than loops or strpos
$ltrimmedLine = ' ' === $this->currentLine[0] ? ltrim($this->currentLine, ' ') : $this->currentLine;
$ltrimmedLine = '' !== $this->currentLine && ' ' === $this->currentLine[0] ? ltrim($this->currentLine, ' ') : $this->currentLine;

return '' !== $ltrimmedLine && '#' === $ltrimmedLine[0];
}
Expand Down

0 comments on commit 6852327

Please sign in to comment.