Skip to content

Blink parity: break multiline grouping paren after boolean operator; gate to 0.5% - #136

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

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

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Breaks the control-paren-wrap cluster. Measured drop: 25 to 21 differing files of 4527 (0.46%), 4 files fixed with zero regressions.

The pattern

When a parenthesized sub-expression after !, &&, or || spans multiple lines, ECS breaks right after the ( so the first operand starts on its own indented line:

return ! (
    $this->getName()
    || $this->firstname
    || ...
);

blink previously left !($this->getName() on the opener line.

Root cause

Pinned via applied-checkers JSON and a skip-bisect to MethodArgumentSpaceFixer: php-cs-fixer MAS processes every ( except one directly preceded by a non-expected keyword, so a grouping paren after a boolean operator is treated like an argument list and, when multiline, gets the fully-multiline break (first operand on its own line).

The fix

isGroupingReflowParen recognizes a ( preceded by !, &&, or ||, wired into the MAS multiline-reflow path alongside call/declaration parens. Scoped to those three operators - a safe subset of php-cs-fixer's selection - so it cannot touch a file ECS leaves alone. The ! ( spacing (a separate fixer) is untouched.

Gate

MAX_DIFF_PERCENT lowered 0.6 to 0.5; actual is 0.46% (21 of 4527).

Fixed: Lead.php (!), EmailController.php (&&), CampaignEventSubscriber.php (||), SugarcrmIntegration.php. Unit tests cover !/&& reflow, the single-line no-op, and that a control-structure if ( is correctly skipped. Full blink suite, go vet, golangci-lint green; strict rector-src 1:1 gate stays 0-diff.

php-cs-fixer's MethodArgumentSpace processes a "(" unless it directly follows
a non-expected keyword, so a grouping paren after "!", "&&" or "||" is
treated like an argument list: when multiline it puts the first operand on its
own indented line. blink only reflowed call and declaration parens; it now also
reflows these boolean grouping parens, matching ECS.
@TomasVotruba
TomasVotruba merged commit 5c27a71 into main Oct 5, 2026
18 checks passed
@TomasVotruba
TomasVotruba deleted the tv-blink-parity-parenwrap branch October 5, 2026 09:28
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