8000 do not trigger deprecations for valid YAML · symfony/symfony@1436349 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1436349

Browse files
committed
do not trigger deprecations for valid YAML
1 parent c419041 commit 1436349

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Symfony/Component/Yaml/Inline.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,8 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
463463
break;
464464
}
465465

466-
if (!isset($mapping[$i + 1]) || ' ' !== $mapping[$i + 1]) {
467-
@trigger_error('Omitting the space after the colon that follows a mapping key definition is deprecated since version 3.2 and will throw a ParseException in 4.0.', E_USER_DEPRECATED);
466+
if (!isset($mapping[$i + 1]) || !in_array($mapping[$i + 1], array(' ', '[', ']', '{', '}'), true)) {
467+
@trigger_error('Using a colon that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}" is deprecated since version 3.2 and will throw a ParseException in 4.0.', E_USER_DEPRECATED);
468468
}
469469

470470
// value

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function testParseInvalidMappingKeyShouldThrowException()
166166

167167
/**
168168
* @group legacy
169-
* @expectedDeprecation Omitting the space after the colon that follows a mapping key definition is deprecated since version 3.2 and will throw a ParseException in 4.0.
169+
* @expectedDeprecation Using a colon that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}" is deprecated since version 3.2 and will throw a ParseException in 4.0.
170170
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
171171
*/
172172
public function testParseMappingKeyWithColonNotFollowedBySpace()
@@ -395,6 +395,8 @@ public function getTestsForParse()
395395
array('[foo, {bar: foo}]', array('foo', array('bar' => 'foo'))),
396396
array('{ foo: {bar: foo} }', array('foo' => array('bar' => 'foo'))),
397397
array('{ foo: [bar, foo] }', array('foo' => array('bar', 'foo'))),
398+
array('{ foo:{bar: foo} }', array('foo' => array('bar' => 'foo'))),
399+
array('{ foo:[bar, foo] }', array('foo' => array('bar', 'foo'))),
398400

399401
array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))),
400402

0 commit comments

Comments
 (0)
0