File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -619,8 +619,14 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
619619 }
620620
621621 $ isItUnindentedCollection = $ this ->isStringUnIndentedCollectionItem ();
622+ $ isItComment = $ this ->isCurrentLineComment ();
622623
623624 while ($ this ->moveToNextLine ()) {
625+ if ($ isItComment && !$ isItUnindentedCollection ) {
626+ $ isItUnindentedCollection = $ this ->isStringUnIndentedCollectionItem ();
627+ $ isItComment = $ this ->isCurrentLineComment ();
628+ }
629+
624630 $ indent = $ this ->getCurrentLineIndentation ();
625631
626632 if ($ isItUnindentedCollection && !$ this ->isCurrentLineEmpty () && !$ this ->isStringUnIndentedCollectionItem () && $ newIndent === $ indent ) {
Original file line number Diff line number Diff line change @@ -74,3 +74,17 @@ yaml: |
7474 'foo #': baz
7575php : |
7676 ['foo #' => 'baz']
77+ ---
78+ test : Comment before first item in unindented collection
79+ brief : >
80+ Comment directly before unindented collection is allowed
81+ yaml : |
82+ collection1:
83+ # comment
84+ - a
85+ - b
86+ collection2:
87+ - a
88+ - b
89+ php : |
90+ ['collection1' => ['a', 'b'], 'collection2' => ['a', 'b']]
You can’t perform that action at this time.
0 commit comments