Skip to content

Commit 71730ef

Browse files
committed
minor #22913 [Yaml] Deprecate tags using colon (GuilhemN)
This PR was squashed before being merged into the 3.4 branch (closes #22913). Discussion ---------- [Yaml] Deprecate tags using colon | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Using a colon in a tag doesn't look like yaml and causes trouble (see symfony/symfony#22878), so I propose to just deprecate these tags in favor of more consistent tags. ```yml - !php/const:PHP_INT_MAX - !php/object:O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";} ``` would become ```yml - !php/const PHP_INT_MAX - !php/object O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";} ``` Commits ------- 9815af3 [Yaml] Deprecate tags using colon
2 parents bdf2c1a + d427bc0 commit 71730ef

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Tests/Encoder/YamlEncoderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ public function testContext()
6161
$obj = new \stdClass();
6262
$obj->bar = 2;
6363

64-
$this->assertEquals(" foo: !php/object:O:8:\"stdClass\":1:{s:3:\"bar\";i:2;}\n", $encoder->encode(array('foo' => $obj), 'yaml'));
64+
$this->assertEquals(" foo: !php/object 'O:8:\"stdClass\":1:{s:3:\"bar\";i:2;}'\n", $encoder->encode(array('foo' => $obj), 'yaml'));
6565
$this->assertEquals(' { foo: null }', $encoder->encode(array('foo' => $obj), 'yaml', array('yaml_inline' => 0, 'yaml_indent' => 2, 'yaml_flags' => 0)));
66-
$this->assertEquals(array('foo' => $obj), $encoder->decode('foo: !php/object:O:8:"stdClass":1:{s:3:"bar";i:2;}', 'yaml'));
67-
$this->assertEquals(array('foo' => null), $encoder->decode('foo: !php/object:O:8:"stdClass":1:{s:3:"bar";i:2;}', 'yaml', array('yaml_flags' => 0)));
66+
$this->assertEquals(array('foo' => $obj), $encoder->decode("foo: !php/object 'O:8:\"stdClass\":1:{s:3:\"bar\";i:2;}'", 'yaml'));
67+
$this->assertEquals(array('foo' => null), $encoder->decode("foo: !php/object 'O:8:\"stdClass\":1:{s:3:\"bar\";i:2;}'", 'yaml', array('yaml_flags' => 0)));
6868
}
6969
}

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"php": "^5.5.9|>=7.0.8"
2020
},
2121
"require-dev": {
22-
"symfony/yaml": "~3.3|~4.0",
22+
"symfony/yaml": "~3.4|~4.0",
2323
"symfony/config": "~2.8|~3.0|~4.0",
2424
"symfony/property-access": "~2.8|~3.0|~4.0",
2525
"symfony/http-foundation": "~2.8|~3.0|~4.0",
@@ -34,7 +34,7 @@
3434
"symfony/dependency-injection": "<3.2",
3535
"symfony/property-access": ">=3.0,<3.0.4|>=2.8,<2.8.4",
3636
"symfony/property-info": "<3.1",
37-
"symfony/yaml": "<3.3"
37+
"symfony/yaml": "<3.4"
3838
},
3939
"suggest": {
4040
"psr/cache-implementation": "For using the metadata cache.",

0 commit comments

Comments
 (0)