Skip to content

Commit 8531f82

Browse files
committed
[Yaml] Fix sequence with following mapping
1 parent ecf9859 commit 8531f82

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/Symfony/Component/Yaml/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ private function lexInlineSequence(string $yaml): string
12421242
$value = $yaml;
12431243

12441244
while ($this->moveToNextLine()) {
1245-
for ($i = 1; isset($this->currentLine[$i]) && ']' !== $this->currentLine[$i]; ++$i) {
1245+
for ($i = 0; isset($this->currentLine[$i]) && ']' !== $this->currentLine[$i]; ++$i) {
12461246
}
12471247

12481248
$trimmedValue = trim($this->currentLine);

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,22 @@ public function inlineNotationSpanningMultipleLinesProvider(): array
16991699
YAML
17001700
,
17011701
],
1702+
'sequence spanning multiple lines nested in mapping with a following mapping' => [
1703+
[
1704+
'foobar' => [
1705+
'foo',
1706+
'bar',
1707+
],
1708+
'bar' => 'baz',
1709+
],
1710+
<<<YAML
1711+
foobar: [
1712+
foo,
1713+
bar,
1714+
]
1715+
bar: baz
1716+
YAML
1717+
],
17021718
'nested sequence nested in mapping starting on the same line' => [
17031719
[
17041720
'foo' => [

0 commit comments

Comments
 (0)