minor #36689 [Yaml] properly handle empty lines (xabbuh)

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
-------

e91bb614ae properly handle empty lines
This commit is contained in:
Nicolas Grekas 2020-05-04 18:38:20 +02:00
commit 6852327eee
1 changed files with 1 additions and 1 deletions

View File

@ -969,7 +969,7 @@ class Parser
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];
}