8000 [Yaml] deprecate parsing mappings without keys · symfony/symfony@e0ea989 · GitHub
[go: up one dir, main page]

Skip to content

Commit e0ea989

Browse files
committed
[Yaml] deprecate parsing mappings without keys
1 parent b1988f7 commit e0ea989

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/Symfony/Component/Yaml/Inline.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
482482
}
483483

484484
if (':' === $key) {
485-
throw new ParseException('A mapping without a key is invalid.');
485+
@trigger_error('Omitting the key of a mapping is deprecated and will throw a ParseException in 4.0.', E_USER_DEPRECATED);
486486
}
487487

488488
if (':' !== $key && (!isset($mapping[$i + 1]) || !in_array($mapping[$i + 1], array(' ', ',', '[', ']', '{', '}'), true))) {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,6 @@ public function testTheEmptyStringIsAValidMappingKey()
703703
*/
704704
public function testMappingKeysCannotBeOmitted()
705705
{
706-
Inline::parse('{: foo}');
707706
$this->assertSame(array(':' => 'foo'), Inline::parse('{: foo}'));
708707
}
709708
}

0 commit comments

Comments
 (0)
0