8000 handle empty lines inside unindented collection · symfony/symfony@bbfe6f7 · GitHub
[go: up one dir, main page]

Skip to content

Commit bbfe6f7

Browse files
committed
handle empty lines inside unindented collection
1 parent f1f5bff commit bbfe6f7

File tree

2 files changed

+17
-1
lines changed

2 files changed

+ 8000 17
-1
lines changed

src/Symfony/Component/Yaml/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
423423

424424
$previousLineIndentation = $indent;
425425

426-
if ($isItUnindentedCollection && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) {
426+
if ($isItUnindentedCollection && !$this->isCurrentLineEmpty() && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) {
427427
$this->moveToPreviousLine();
428428
break;
429429
}

src/Symfony/Component/Yaml/Tests/ParserTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,22 @@ public function getBlockChompingTests()
189189
);
190190
$tests['Literal block chomping clip with multiple trailing newlines'] = array($expected, $yaml);
191191

192+
$yaml = <<<'EOF'
193+
foo:
194+
- bar: |
195+
one
196+
197+
two
198+
EOF;
199+
$expected = array(
200+
'foo' => array(
201+
array(
202+
'bar' => "one\n\ntwo",
203+
),
204+
),
205+
);
206+
$tests['Literal block chomping clip with embedded blank line inside unindented collection'] = array($expected, $yaml);
207+
192208
$yaml = <<<'EOF'
193209
foo: |
194210
one

0 commit comments

Comments
 (0)
0