Skip to content

Fix mixed indents in block strings #77

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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

janedbal
Copy link

  • bug fix
  • BC break? no

  • When using custom indents (spaces) and block mode, inner part of block strings were always indented with tab.
  • This showed up in our git-based whitespace check in pre-commit (git diff-index --check --cached HEAD -- $FILES) as space before tab in indent error.
  • The real usecase is PHPStan baseline of deprecated usages where newline is very often.

Before:

inner:
    msg: '''
    	string
    	with newline
    '''

After this fix:

inner:
    msg: '''
        string
        with newline
    '''

@janedbal
Copy link
Author

@dg Any chance you find a minute to look at this? Thank you

@dg dg force-pushed the master branch 2 times, most recently from 30032d8 to 90a0d3f Compare June 18, 2025 19:35
@dg
Copy link
Member

dg commented Jun 19, 2025

Wouldn't it be easier to solve it in StringNode using property $indentation as in BlockArrayNode?

@janedbal
Copy link
Author

Wouldn't it be easier to solve it in StringNode using property $indentation as in BlockArrayNode?

Tried in #78, but StringNode is also created in Parser::parseValue where I was not sure how to get the indent properly...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants