Skip to content

Fix PER-CS blank line between import groups being stripped - #206

Merged
TomasVotruba merged 2 commits into
mainfrom
fix-blank-line-between-import-groups-priority
Oct 13, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
fix-blank-line-between-import-groups-priority

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Fixes ecsphp/ecs#336

NoBlankLineBetweenImportsFixer ran at priority -50, after BlankLineBetweenImportGroupsFixer (-40). In the PER_CS set the group fixer adds the required blank line between import groups (class vs use function/use const), then this fixer removed it again, so BlankLineBetweenImportGroupsFixer was effectively a no-op.

Raise the priority to -35: still after OrderedImportsFixer (-30), now before BlankLineBetweenImportGroupsFixer (-40). The fixer collapses blank lines between consecutive use statements first, then the group fixer re-adds the single blank line between groups. Result matches PER Coding Style v3.1 rule 3.

Added a regression test composing both fixers that covers keeping an existing group blank line and adding a missing one.

…sFixer

Priority -50 ran after BlankLineBetweenImportGroupsFixer (-40), stripping
the PER-CS blank line between import groups. Raise to -35 so it runs after
OrderedImportsFixer but before the group fixer, keeping the group blank line.
Keep the blink Go engine in parity with the PHP fixer by running
NoBlankLineBetweenImportsFixer before BlankLineBetweenImportGroupsFixer.
@TomasVotruba
TomasVotruba enabled auto-merge (squash) October 13, 2026 13:30
@TomasVotruba
TomasVotruba merged commit c3d7952 into main Oct 13, 2026
20 checks passed
@TomasVotruba
TomasVotruba deleted the fix-blank-line-between-import-groups-priority branch October 13, 2026 13:32
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.

BlankLineBetweenImportGroupsFixer is effectively ignored from PER_CS set

1 participant