-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Yaml] Improve YAML boolean escaping #13262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
3760e67
81a8090
1e0633e
a0ec0fe
afe827a
8fa056b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,8 @@ private static function containsCharRequiresSingleQuoting($value) | |
*/ | ||
private static function isValueRequiresSingleQuoting($value) | ||
{ | ||
// Note that whilst 'y' and 'n' are not supported as valid Booleans, | ||
// they are escaped here for interoperability. | ||
return in_array(strtolower($value), array('null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off')); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to myself and others: even if we do not support 'y', 'n', ... as valid Booleans, it does not hurt to escape them here for interoperability. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest adding it as a comment to avoid removing it by mistake in the future |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesValueRequireSingleQuoting
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm wondering if we really need those 2 private methods. What about inlining them with the right comments instead? Especially as they can be called quite a lot.