Skip to content

Commit f58be05

Browse files
committed
feature #12090 [Yaml] Tweaked the DUMP_NULL_AS_TILDE explanation (javiereguiluz)
This PR was squashed before being merged into the 4.4 branch (closes #12090). Discussion ---------- [Yaml] Tweaked the DUMP_NULL_AS_TILDE explanation I couldn't add my review to #12071 on time, so that's why I create this PR. It's OK to close this without merging if you disagree with it. Thanks. Commits ------- ea71f5a [Yaml] Tweaked the DUMP_NULL_AS_TILDE explanation
2 parents 758a4b3 + ea71f5a commit f58be05

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

components/yaml.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -375,17 +375,17 @@ objects, they are automatically transformed into YAML tags::
375375
$dumped = Yaml::dump($data);
376376
// $dumped = '!my_tag { foo: bar }'
377377

378-
Dumping null
379-
~~~~~~~~~~~~
378+
Dumping Null Values
379+
~~~~~~~~~~~~~~~~~~~
380380

381-
``null`` values will be represented with ``null`` by default::
381+
The official YAML specification uses both ``null`` and ``~`` to represent null
382+
values. This component uses ``null`` by default when dumping null values but
383+
you can dump them as ``~`` with the ``DUMP_NULL_AS_TILDE`` flag::
382384

383-
$dumped = Yaml::dump(array('foo' => null));
385+
$dumped = Yaml::dump(['foo' => null]);
384386
// foo: null
385387

386-
You can represent them with ``~`` by using the ``DUMP_NULL_AS_TILDE`` flag::
387-
388-
$dumped = Yaml::dump(array('foo' => null), 2, 4, Yaml::DUMP_NULL_AS_TILDE);
388+
$dumped = Yaml::dump(['foo' => null], 2, 4, Yaml::DUMP_NULL_AS_TILDE);
389389
// foo: ~
390390

391391
.. versionadded:: 4.4

0 commit comments

Comments
 (0)