Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb71d2c0

Browse files
committed
Merge branch '3.4'
* 3.4: Fix php/object type example [yaml] Fix `!php/*` tag should not contain `:` at the end for Symfony 4
2 parents123999b +d18ec42 commitb71d2c0

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
@@ -243,7 +243,7 @@ You can dump objects by using the ``DUMP_OBJECT`` flag::
243243
$object->foo = 'bar';
244244

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

248248
And parse them by using the ``PARSE_OBJECT`` flag::
249249

@@ -269,7 +269,7 @@ By default the parser will encode invalid types as ``null``. You can make the
269269
parser throw exceptions by using the ``PARSE_EXCEPTION_ON_INVALID_TYPE``
270270
flag::
271271

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

275275
Similarly you can use ``DUMP_EXCEPTION_ON_INVALID_TYPE`` when dumping::
@@ -319,10 +319,10 @@ Parsing PHP Constants
319319
~~~~~~~~~~~~~~~~~~~~~
320320

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

325-
$yaml = '{ foo: PHP_INT_SIZE, bar: !php/const:PHP_INT_SIZE }';
325+
$yaml = '{ foo: PHP_INT_SIZE, bar: !php/constPHP_INT_SIZE }';
326326
$parameters = Yaml::parse($yaml, Yaml::PARSE_CONSTANT);
327327
// $parameters = array('foo' => 'PHP_INT_SIZE', 'bar' => 8);
328328

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp