Skip to content

Blink parity: collapse blank lines between call/parameter arguments; gate to 0.4% - #137

Merged
TomasVotruba merged 3 commits into
mainfrom
tv-blink-parity-attrblank
Oct 5, 2026
Merged

TomasVotruba merged 3 commits into
mainfrom
tv-blink-parity-attrblank

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Collapses stray blank lines between function/call arguments. Measured drop: 21 to 15 differing files of 4527 (0.33%), 6 files fixed with zero regressions.

The issue

Pristine files had blank lines between arguments; ECS removes them, blink preserved them. Most visible with promoted constructor params carrying standalone attributes:

public function __construct(
    #[Autowire(env: 'json:...')]
    array $servers,
                          // blink kept a blank line here; ECS does not
    #[Autowire(env: 'string:...')]
    string $namespace,

Root cause and fix

Verified against real ECS (applied-checkers: MethodArgumentSpaceFixer): ECS collapses blank lines between call and declaration/parameter arguments (plain params, attributed promoted params, and plain call args), but preserves blank lines between array-literal items. blink's shared reflowParen preserved blanks in every context.

A collapseBlanks flag is threaded through reflowParen → reflowAfterComma → argNLAfterComma. Call/declaration/parameter callers collapse; array callers (ArrayListItemNewline, StandaloneLineInMultilineArray) preserve. This keeps the array-blank behavior that a prior change showed must be preserved.

Gate

MAX_DIFF_PERCENT lowered 0.5 to 0.4; actual is 0.33% (15 of 4527).

Fixed the 3 attribute-param files plus 3 more with the same blank-line issue (ConsoleErrorListener, EmailSubscriberTest, WebhookSubscriberTest). Unit tests cover attributed-param collapse, plain call-arg collapse, and array-item blank preservation. Full blink suite, go vet, golangci-lint green; strict rector-src 1:1 gate stays 0-diff.

php-cs-fixer's MethodArgumentSpace collapses a blank line between the arguments
of a call or declaration (including promoted params with standalone attributes),
but a blank line between array items is kept. reflowParen preserved blanks for
every context; it now collapses them for call/declaration/parameter parens and
keeps them only for array literals.
The call/parameter blank-line collapse removed a blank line that precedes a
comment annotating the next argument; php-cs-fixer keeps it. Preserve the
blank line when the next token after the comma is a non-attribute comment.
@TomasVotruba
TomasVotruba enabled auto-merge (squash) October 5, 2026 09:49
@TomasVotruba
TomasVotruba disabled auto-merge October 5, 2026 09:51
@TomasVotruba
TomasVotruba merged commit 8824835 into main Oct 5, 2026
18 checks passed
@TomasVotruba
TomasVotruba deleted the tv-blink-parity-attrblank branch October 5, 2026 09: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