Skip to content

Blink parity: glue by-reference arrow fn space; gate to 0.1% - #143

Merged
TomasVotruba merged 2 commits into
mainfrom
tv-blink-parity-zero
Oct 5, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
tv-blink-parity-zero

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Removes the space in a by-reference arrow function. Measured drop: 5 to 4 differing files of 4527 (0.088%).

The fix

FunctionDeclarationFixer with closure_fn_spacing=none (the mautic config) clears the whitespace right after the fn keyword for a lambda, regardless of a following &. blink only did so when ( directly followed fn, so fn &() kept its space:

return \Closure::bind(fn&() => $this->{$property}, $this, parent::class)();

fnIsArrowFn now also recognizes the by-reference form fn &(, so the space is glued.

Gate

MAX_DIFF_PERCENT lowered 0.15 to 0.1; actual is 0.088% (4 of 4527).

Unit tests cover by-ref glue under none and the single-space kept under one. Full blink suite, go vet, golangci-lint green; strict rector-src 1:1 gate stays 0-diff.

Remaining 4 (blocked - require ECS-quirk or lexer changes)

  • FieldsTypeTrait: list-destructuring expansion is a context-dependent position-staleness artifact (expands only when nested in a closure-as-array-value; top-level stays single-line), so a general rule would over-apply and break the rector gate.
  • webhook-failing / webhook-killed.html.php: ECS's ArrayIndentation emits an internally-inconsistent 4/12/0 indent for an array opener buried mid-line in a T_INLINE_HTML token; matching it means emulating a php-cs-fixer quirk not provably safe for the rector gate.
  • SummarizeCommand: array inside a complex-interpolation string; reflowing needs the lexer to tokenize {$...} contents, which blink treats as atomic - a change that ripples across every interpolated string and cannot keep the 1705-file rector gate at 0-diff.

FunctionDeclaration with closure_fn_spacing=none removes the whitespace after
the fn keyword, but blink only did so when "(" followed directly. A
by-reference arrow function "fn &() => ..." has the "(" after "&"; blink now
recognizes it and glues "fn&(", matching php-cs-fixer.
@TomasVotruba
TomasVotruba merged commit 5533238 into main Oct 5, 2026
18 checks passed
@TomasVotruba
TomasVotruba deleted the tv-blink-parity-zero branch October 5, 2026 16:36
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