Closed
Description
I have a YML file that I parse, which has the following syntax for an empty array:
some_field: [ ]
Upon dumping the same YML file, and not adjusting some_field
, the value is dumped as:
some_field: { }
My understanding is that the { }
syntax is intended for objects, not arrays. As such, I isolated the code found in the dumpArray
function which was introducing this behavior:
https://github.com/symfony/yaml/blob/2.8/Inline.php#L191
return sprintf('{ %s }', implode(', ', $output));
.... adjusted to ....
return sprintf('[ %s ]', implode(', ', $output));
... fixes this issue.
Is there a reason why this is using the object-based syntax and not the array syntax?