8000 [Yaml] Improve YAML boolean escaping by petert82 · Pull Request #13262 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Symfony/Component/Yaml/Escaper.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ private static function containsCharRequiresSingleQuoting($value)
*/
private static function isValueRequiresSingleQuoting($value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesValueRequireSingleQuoting?

Copy link
Member

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.

{
// 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'));
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The 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

}
}
0