Blink parity: break multiline grouping paren after boolean operator; gate to 0.5% - #136
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: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
isGroupingReflowParenrecognizes 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_PERCENTlowered 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-structureif (is correctly skipped. Full blink suite, go vet, golangci-lint green; strict rector-src 1:1 gate stays 0-diff.