Skip to content

[Yaml] Fix wrong line number when comments are inserted in the middle of a block. #17733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prev Previous commit
Next Next commit
[Yaml] Fix comment and change method name
  • Loading branch information
paradajozsef committed May 6, 2016
commit bf4501a535237dceeafa4b8042fbfdd6f61b237a
6 changes: 3 additions & 3 deletions src/Symfony/Component/Yaml/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
}

// we ignore "comment" lines only when we are not inside a scalar block
if (empty($blockScalarIndentations) && $this->isCurrentLineComment() && false === $this->isPreviousNonCommentLineIsCollectionItem()) {
if (empty($blockScalarIndentations) && $this->isCurrentLineComment() && false === $this->checkIfPreviousNonCommentLineIsCollectionItem()) {
continue;
}

Expand Down Expand Up @@ -826,11 +826,11 @@ private function isCurrentLineCollectionItem()
}

/**
* Tests whether or not the current comment line is in a collection.
* Tests whether the current comment line is in a collection.
*
* @return bool
*/
private function isPreviousNonCommentLineIsCollectionItem()
private function checkIfPreviousNonCommentLineIsCollectionItem()
{
$isCollectionItem = false;
$moves = 0;
Expand Down