Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions components/yaml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,23 @@ objects, they are automatically transformed into YAML tags::
$dumped = Yaml::dump($data);
// $dumped = '!my_tag { foo: bar }'

Dumping null
~~~~~~~~~~~~

``null`` values will be represented with ``null`` by default::

$dumped = Yaml::dump(array('foo' => null));
// foo: null

You can represent them with ``~`` by using the ``DUMP_NULL_AS_TILDE`` flag::

$dumped = Yaml::dump(array('foo' => null), 2, 4, Yaml::DUMP_NULL_AS_TILDE);
// foo: ~

.. versionadded:: 4.4

The flag to dump ``null`` as ``~`` was introduced in Symfony 4.4.

Syntax Validation
~~~~~~~~~~~~~~~~~

Expand Down