Repository navigation
Blink parity: closure-body expansion, operator linebreak, trim-array comma; gate to 0.15% - #141
Merged
Merged
Conversation
php-cs-fixer's OperatorLinebreak also moves "->", "?->" and "::" (object operator kinds + T_PAAMAYIM_NEKUDOTAYIM) to the beginning of the next line when they end a line in a multiline expression. blink excluded them, leaving a wrapped method chain with "->" trailing; now they are moved like ECS.
Honor BracesPosition's allow_single_line_anonymous_functions=false: a single-line anonymous function body is put on its own lines, matching php-cs-fixer. An empty body, one already on its own line, or one sharing the brace line with a comment is left alone.
TrimArraySpaces removed the single-line space before "]" even after a
trailing comma ("1, ]" -> "1,]"); php-cs-fixer keeps it when the preceding
token is a comma. Guard the trailing-space trim against a preceding comma.
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.
Three endgame parity fixes. Measured drop: 8 to 5 differing files of 4527 (0.11%).
1. OperatorLinebreak: object operators and
::OperatorLinebreakFixer's token set includes->,?->, and::, which blink excluded - so a wrapped method chain kept the operator trailing instead of moving it to the line start. Added them to blink's operator set. (SlotNameTypeValidator.php)2. BracesPosition: expand single-line closure bodies
With
allow_single_line_anonymous_functions: false(the mautic config), ECS expands a single-line closure body onto multiple lines:blink accepted the option but ignored it. Implemented the expansion, guarded against empty bodies, already-multiline bodies, and a comment on the brace line. (CommonRepositoryTest.php)
3. TrimArraySpaces: keep space after a trailing comma
php-cs-fixer keeps the space before
]when the preceding token is a,(1, ]); blink trimmed it. Added the trailing-comma guard. (CampaignControllerFunctionalTest.php)Gate
MAX_DIFF_PERCENTlowered 0.2 to 0.15; actual is 0.11% (5 of 4527).Each fix carries a focused unit test. Full blink suite, go vet, golangci-lint green; strict rector-src 1:1 gate stays 0-diff.
Remaining 5 (not in this PR)
Lexer/scope-bound: array inside an interpolated string (SummarizeCommand - interpolated strings are one token),
fn&()by-ref spacing (context-dependent, low yield), list-destructuring expansion (FieldsTypeTrait - conflicts with an existing destructuring guard), and two.html.phptemplates (array indentation inside a deeply-indented inline-HTML PHP block).