-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Description
I'm currently migrating a legacy project to Symfony 4. The old application is built quite a lot around YAML configuration files, written according to the YAML 1.1 specification.
One of the main differences to the YAML 1.2 specification that Symfony 2/3/4 implements is that unquoted literals on, off, yes and no are parsed as boolean values while YAML 1.2 only allows true and false.
For example, the Symfony 1.2 documentation advertises the usage of the alternative boolean literals:
default:
is_secure: offThe nasty part is that a YAML 1.2 parser would not fail on those literals, but instead parse them as strings. Of course, we need to fix our YAML files, but I'd like to make sure we don't introduce any regressions. This is why I'd like Symfony's YAML linter command to report the usage of those literals. It shouldn't do so by default, but I'd like to be able to configure the command accordingly.
Possible Solution
I've looked into this already and the best idea I could come up with is introducing a flag that makes the Symfony\Component\Yaml\Inline class throw a ParseException if one of the legacy literals is encountered unquoted. That flag could be leveraged by introducing an option (e.g. --fail-on-legacy-bool) to the LintCommand.
Should I submit a PR?