Skip to content

Commit 5bdadef

Browse files
jeromemaciasweaverryan
authored andcommitted
[yaml] Fix !php/* tag should not contain : at the end for Symfony 4
As mentioned in the [upgrade guide](https://github.com/symfony/symfony/blob/master/UPGRADE-4.0.md): > The !php/object: tag was removed in favor of the !php/object tag (without the colon). > The !php/const: tag was removed in favor of the !php/const tag (without the colon).
1 parent f76f962 commit 5bdadef

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

components/yaml.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ You can dump objects by using the ``DUMP_OBJECT`` flag::
250250
$object->foo = 'bar';
251251

252252
$dumped = Yaml::dump($object, 2, 4, Yaml::DUMP_OBJECT);
253-
// !php/object:O:8:"stdClass":1:{s:5:"foo";s:7:"bar";}
253+
// !php/object O:8:"stdClass":1:{s:5:"foo";s:7:"bar";}
254254

255255
And parse them by using the ``PARSE_OBJECT`` flag::
256256

@@ -276,7 +276,7 @@ By default the parser will encode invalid types as ``null``. You can make the
276276
parser throw exceptions by using the ``PARSE_EXCEPTION_ON_INVALID_TYPE``
277277
flag::
278278

279-
$yaml = '!php/object:O:8:"stdClass":1:{s:5:"foo";s:7:"bar";}';
279+
$yaml = '!php/object O:8:"stdClass":1:{s:5:"foo";s:7:"bar";}';
280280
Yaml::parse($yaml, Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE); // throws an exception
281281

282282
Similarly you can use ``DUMP_EXCEPTION_ON_INVALID_TYPE`` when dumping::
@@ -326,10 +326,10 @@ Parsing PHP Constants
326326
~~~~~~~~~~~~~~~~~~~~~
327327

328328
By default, the YAML parser treats the PHP constants included in the contents as
329-
regular strings. Use the ``PARSE_CONSTANT`` flag and the special ``!php/const:``
329+
regular strings. Use the ``PARSE_CONSTANT`` flag and the special ``!php/const``
330330
syntax to parse them as proper PHP constants::
331331

332-
$yaml = '{ foo: PHP_INT_SIZE, bar: !php/const:PHP_INT_SIZE }';
332+
$yaml = '{ foo: PHP_INT_SIZE, bar: !php/const PHP_INT_SIZE }';
333333
$parameters = Yaml::parse($yaml, Yaml::PARSE_CONSTANT);
334334
// $parameters = array('foo' => 'PHP_INT_SIZE', 'bar' => 8);
335335

0 commit comments

Comments
 (0)