Skip to content

Conversation

@yoeunes
Copy link
Contributor

@yoeunes yoeunes commented Nov 15, 2025

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues -
License MIT

This PR is a follow-up to #62359 based on feedback from @xabbuh regarding spec compliance.

My previous PR fixed a ParseException on blank lines, but it handled comments incorrectly (it ignored them inside the scalar).

This PR aligns the parser with the YAML spec (3.2.3.3):

  1. It keeps the fix for blank lines (they are correctly preserved).
  2. It changes comment handling: instead of ignoring an indented comment, the parser now terminates the multiline scalar when it encounters one.

];

yield 'blank lines and comments' => [
yield 'blank lines are preserved and comment stops scalar' => [
Copy link
Member

Choose a reason for hiding this comment

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

I think we should also have a test covering that an exception is thrown when the comment is not at the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added a new dedicated test testUnquotedMultilineScalarThrowsOnOrphanedLineAfterComment

@yoeunes yoeunes force-pushed the yaml-align-multiline-scalar-comment-spec branch from fb61e7d to 7911644 Compare November 15, 2025 17:13
@nicolas-grekas
Copy link
Member

Thank you @yoeunes.

@nicolas-grekas nicolas-grekas merged commit 76047b6 into symfony:6.4 Nov 16, 2025
10 of 11 checks passed
This was referenced Nov 16, 2025
This was referenced Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants