Skip to content

Commit 5fc8e86

Browse files
committed
[Yaml] Small optimization of the parser
1 parent d6e8937 commit 5fc8e86

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/Yaml/Parser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
400400
$blockScalarIndentations = array();
401401

402402
if ($this->isBlockScalarHeader()) {
403-
$blockScalarIndentations[] = $this->getCurrentLineIndentation();
403+
$blockScalarIndentations[] = $oldLineIndentation;
404404
}
405405

406406
if (!$this->moveToNextLine()) {
@@ -450,14 +450,14 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
450450
// terminate all block scalars that are more indented than the current line
451451
if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && trim($this->currentLine) !== '') {
452452
foreach ($blockScalarIndentations as $key => $blockScalarIndentation) {
453-
if ($blockScalarIndentation >= $this->getCurrentLineIndentation()) {
453+
if ($blockScalarIndentation >= $indent) {
454454
unset($blockScalarIndentations[$key]);
455455
}
456456
}
457457
}
458458

459459
if (empty($blockScalarIndentations) && !$this->isCurrentLineComment() && $this->isBlockScalarHeader()) {
460-
$blockScalarIndentations[] = $this->getCurrentLineIndentation();
460+
$blockScalarIndentations[] = $indent;
461461
}
462462

463463
$previousLineIndentation = $indent;

0 commit comments

Comments
 (0)