From 9df531a751e1745e9193fc70d3bae42be4cfca00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Farys?= Date: Thu, 3 Jan 2019 09:37:59 +0100 Subject: [PATCH] XmlEncoder example fix Currently in example: ``` $encoder = new XmlEncoder(); $encoder->encode(array('foo' => array('@bar' => 'value'), 'qux' => array('#comment' => 'A comment)); ``` we'll get `Parse error: syntax error, unexpected '', $serialized); ' (T_CONSTANT_ENCAPSED_STRING), expecting ')'`. After close `A comment` string and add missing `$format`, it works correctly. ``` $encoder->encode(array('foo' => array('@bar' => 'value'), 'qux' => array('#comment' => 'A comment')), 'xml'); ``` --- components/serializer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/serializer.rst b/components/serializer.rst index db1b1df3467..ae2868c5ceb 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -802,7 +802,7 @@ Be aware that this encoder will consider keys beginning with ``@`` as attributes the key ``#comment`` for encoding XML comments:: $encoder = new XmlEncoder(); - $encoder->encode(array('foo' => array('@bar' => 'value'), 'qux' => array('#comment' => 'A comment)); + $encoder->encode(array('foo' => array('@bar' => 'value'), 'qux' => array('#comment' => 'A comment')), 'xml'); // will return: // //