File tree 2 files changed +43
-2
lines changed
src/Symfony/Component/Yaml
2 files changed +43
-2
lines changed Original file line number Diff line number Diff line change @@ -199,9 +199,8 @@ private function doParse(string $value, int $flags)
199
199
|| self ::preg_match ('#^(?P<key> ' .Inline::REGEX_QUOTED_STRING .'|[^ \'"\{\[].*?) *\:(\s+(?P<value>.+?))?\s*$#u ' , $ this ->trimTag ($ values ['value ' ]), $ matches )
200
200
)
201
201
) {
202
- // this is a compact notation element, add to next block and parse
203
202
$ block = $ values ['value ' ];
204
- if ($ this ->isNextLineIndented ()) {
203
+ if ($ this ->isNextLineIndented () || isset ( $ matches [ ' value ' ]) && ' >- ' === $ matches [ ' value ' ] ) {
205
204
$ block .= "\n" .$ this ->getNextEmbedBlock ($ this ->getCurrentLineIndentation () + \strlen ($ values ['leadspaces ' ]) + 1 );
206
205
}
207
206
@@ -949,6 +948,10 @@ private function isNextLineIndented(): bool
949
948
} while (!$ EOF && ($ this ->isCurrentLineEmpty () || $ this ->isCurrentLineComment ()));
950
949
951
950
if ($ EOF ) {
951
+ for ($ i = 0 ; $ i < $ movements ; ++$ i ) {
952
+ $ this ->moveToPreviousLine ();
953
+ }
954
+
952
955
return false ;
953
956
}
954
957
Original file line number Diff line number Diff line change @@ -2690,6 +2690,44 @@ public static function circularReferenceProvider()
2690
2690
return $ tests ;
2691
2691
}
2692
2692
2693
+ public function testBlockScalarArray ()
2694
+ {
2695
+ $ yaml = <<<'YAML'
2696
+ anyOf:
2697
+ - $ref: >-
2698
+ #/string/bar
2699
+ anyOfMultiline:
2700
+ - $ref: >-
2701
+ #/string/bar
2702
+ second line
2703
+ nested:
2704
+ anyOf:
2705
+ - $ref: >-
2706
+ #/string/bar
2707
+ YAML;
2708
+ $ expected = [
2709
+ 'anyOf ' => [
2710
+ 0 => [
2711
+ '$ref ' => '#/string/bar ' ,
2712
+ ],
2713
+ ],
2714
+ 'anyOfMultiline ' => [
2715
+ 0 => [
2716
+ '$ref ' => '#/string/bar second line ' ,
2717
+ ],
2718
+ ],
2719
+ 'nested ' => [
2720
+ 'anyOf ' => [
2721
+ 0 => [
2722
+ '$ref ' => '#/string/bar ' ,
2723
+ ],
2724
+ ],
2725
+ ],
2726
+ ];
2727
+
2728
+ $ this ->assertSame ($ expected , $ this ->parser ->parse ($ yaml ));
2729
+ }
2730
+
2693
2731
/**
2694
2732
* @dataProvider indentedMappingData
2695
2733
*/
You can’t perform that action at this time.
0 commit comments