crmpicco crmpicco -4 years ago 240
YAML Question

Deprecated | (pipe) symbol with unquoted content in Yaml translation files in Symfony 2.8.18

I am upgrading to Symfony 2.8.18 and I note the following comment in the upgrade notes

Deprecated usage of @, `, |, and > at the beginning of an unquoted

What is not clear is does this include Yaml translations/content such as the following:

info: |
You can upgrade to Ayrshire Minis Premium at any time. Just visit for more information.

Should this be amended to the following?

info: |
"You can upgrade to Ayrshire Minis Premium at any time. Just visit for more information."

The New in Symfony 2.8: YAML deprecations blog post on the official Symfony site does not give an example or extrapolate on this

Answer Source

They could get at least the terminology right. There is nothing like an unquoted string in YAML. From what they say, I infer they mean a plain flow scalar.

By the YAML spec, @ and ` are illegal at the beginning of such a scalar because they are reserved for future use. | and > are obviously illegal because they start block scalars. They give this previously-working example in their blog post:

arguments: [`string`, |string, >string]

So it means that you cannot use | and > inside flow content to start plain scalars. This could be theoretically allowed because it is not ambiguous, as block scalars cannot exist within flow content, but the YAML specification still forbids it.

From their explanation, this has no impact on block scalars (everything else would mean that they are not supporting one major YAML feature anymore, which would be beyond strange).

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