Skip to content

Fix tab indent of reprinted nodes with withIndent("\t", 1) - #9087

Merged
TomasVotruba merged 1 commit into
mainfrom
tv/tab-indent-level-columns
Nov 29, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
tv/tab-indent-level-columns

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Closes rectorphp/rector#9974

php-parser keeps the indent level in columns, where a tab counts as 4, and passes it to setIndentLevel() when reprinting a node in format-preserving mode. Our override repeated the indent char by that level, so 1 tab of original indent became 4 tabs (e.g. a method with a changed docblock).

Now the level is kept in columns for tabs too and converted back to tabs on print.

@TomasVotruba
TomasVotruba merged commit e992388 into main Nov 29, 2026
51 checks passed
@TomasVotruba
TomasVotruba deleted the tv/tab-indent-level-columns branch November 29, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Fix indentSize behaviour when using tabs

1 participant