ShinDarth ShinDarth - 1 year ago 157
YAML Question

Symfony Yaml component: how to always wrap string in quotes when using Yaml::dump

When using the Yaml::dump function of Symfony Yaml component, the output will have some strings wrapped by single quotes and other strings not wrapped at all.

I know that both wrapped and non-wrapped strings are correct in Yaml, but I was wondering if there was a way to standardize the ouput (e.g. setting strings always be wrapped by single or double quotes) in order to make it consistent.

Answer Source

According to the documentation, dump takes some flags. They are listed at the top of the documentation (without explanation):


None of these have to do with quotation, so the answer is: No, it's not possible. Quotation is decided by the Escaper, which does not have any customization options.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download