Skip to content

Commit 1113c68

Browse files
Merge branch '3.4' into 4.4
* 3.4: [Filesystem] Handle paths on different drives [WebProfiler] Do not add src-elem CSP directives if they do not exist [Yaml] fix parse error when unindented collections contain a comment [3.4][Inflector] Improve testSingularize() argument name [PhpUnitBridge] fix PHP 5.3 compat again Skip validation when email is an empty object fix sr_Latn translation [Validator] fix lazy property usage. Fix annotation [PhpUnitBridge] fix compat with PHP 5.3 [DX] Show the ParseException message in YAML file loaders
2 parents b385dce + b5b70b9 commit 1113c68

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

Parser.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,8 +618,14 @@ private function getNextEmbedBlock(int $indentation = null, bool $inSequence = f
618618
}
619619

620620
$isItUnindentedCollection = $this->isStringUnIndentedCollectionItem();
621+
$isItComment = $this->isCurrentLineComment();
621622

622623
while ($this->moveToNextLine()) {
624+
if ($isItComment && !$isItUnindentedCollection) {
625+
$isItUnindentedCollection = $this->isStringUnIndentedCollectionItem();
626+
$isItComment = $this->isCurrentLineComment();
627+
}
628+
623629
$indent = $this->getCurrentLineIndentation();
624630

625631
if ($isItUnindentedCollection && !$this->isCurrentLineEmpty() && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) {

Tests/Fixtures/sfComments.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,17 @@ yaml: |
7474
'foo #': baz
7575
php: |
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']]

0 commit comments

Comments
 (0)