From be8d7dcc80ab2f635a4cd9ea130f15df13372e52 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Fri, 30 Mar 2018 17:02:39 +0200 Subject: [PATCH] [Yaml] Add an option to dump null as tilde --- components/yaml.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/yaml.rst b/components/yaml.rst index ec47ea6a9ee..ab237f371f3 100644 --- a/components/yaml.rst +++ b/components/yaml.rst @@ -379,6 +379,17 @@ objects, they are automatically transformed into YAML tags:: $dumped = Yaml::dump($data); // $dumped = '!my_tag { foo: bar }' +Dumping null +~~~~~~~~~~~~~ + +By default, the dumper will represent ``null`` values with ``null``:: + + Yaml::dump(array('foo' => null)); // foo: null + +You can make it represent them with ``~`` by using the ``DUMP_NULL_AS_TILDE`` flag:: + + Yaml::dump(array('foo' => null), 2, 4, Yaml::DUMP_NULL_AS_TILDE); // foo: ~ + Syntax Validation ~~~~~~~~~~~~~~~~~