Skip to content

Commit

Permalink
bug #20855 [Yaml] do not trigger deprecations for valid YAML (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.2 branch.

Discussion
----------

[Yaml] do not trigger deprecations for valid YAML

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19874
| License       | MIT
| Doc PR        |

Commits
-------

1436349 do not trigger deprecations for valid YAML
  • Loading branch information
fabpot committed Dec 13, 2016
2 parents 126c7ff + 1436349 commit a1a058b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/Yaml/Inline.php
Expand Up @@ -463,8 +463,8 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
break;
}

if (!isset($mapping[$i + 1]) || ' ' !== $mapping[$i + 1]) {
@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);
if (!isset($mapping[$i + 1]) || !in_array($mapping[$i + 1], array(' ', '[', ']', '{', '}'), true)) {
@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);
}

// value
Expand Down
4 changes: 3 additions & 1 deletion src/Symfony/Component/Yaml/Tests/InlineTest.php
Expand Up @@ -166,7 +166,7 @@ public function testParseInvalidMappingKeyShouldThrowException()

/**
* @group legacy
* @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.
* @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.
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
*/
public function testParseMappingKeyWithColonNotFollowedBySpace()
Expand Down Expand Up @@ -395,6 +395,8 @@ public function getTestsForParse()
array('[foo, {bar: foo}]', array('foo', array('bar' => 'foo'))),
array('{ foo: {bar: foo} }', array('foo' => array('bar' => 'foo'))),
array('{ foo: [bar, foo] }', array('foo' => array('bar', 'foo'))),
array('{ foo:{bar: foo} }', array('foo' => array('bar' => 'foo'))),
array('{ foo:[bar, foo] }', array('foo' => array('bar', 'foo'))),

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

Expand Down

0 comments on commit a1a058b

Please sign in to comment.