Skip to content

Preserve author-added empty lines between reflowed arguments in blink - #160

Merged
TomasVotruba merged 1 commit into
mainfrom
blink-preserve-empty-lines-promoted-property
Oct 7, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
blink-preserve-empty-lines-promoted-property

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Follow-up to #159, which made StandaloneLinePromotedPropertyFixer (PHP) keep author-added empty lines between constructor arguments. The blink (Go) port still collapsed them, so blink diverged from ECS.

Root cause

reflowParen() took a collapseBlanks flag. Constructor/call rules passed true, which collapsed a blank line between reflowed arguments down to a single newline (kept only before a plain comment). That mirrored the old PHP behavior. After #159 every PHP fixer routed through TokensNewliner::breakItems() preserves blank lines, so the flag no longer had a PHP counterpart.

Change

Dropped collapseBlanks and made argNLAfterComma() always keep an author-added blank line (2+ line endings), matching the PHP side. This covers every reflowParen() caller: promoted / plain / required constructor params, call-argument spacing, and arrays (arrays already preserved).

Updated the two tests that asserted the old collapse behavior to assert preservation instead - consistent with the existing note in method_argument_space_phpcsfixer_test.go that mautic parity needs blank lines kept. Added a promoted-property case covering a blank line before an #[Attribute].

@TomasVotruba
TomasVotruba enabled auto-merge (squash) October 7, 2026 20:51
@TomasVotruba
TomasVotruba merged commit 8a4e205 into main Oct 7, 2026
18 of 19 checks passed
@TomasVotruba
TomasVotruba deleted the blink-preserve-empty-lines-promoted-property branch October 7, 2026 20:52
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.

1 participant