Port php-cs-fixer StatementIndentation test cases (WIP) - #132
Merged
Merged
Conversation
Move all 86 cases from php-cs-fixer StatementIndentationFixerTest into a Go table test. blink matches 27; the 59 it does not yet match are gated behind a documented known-failures allowlist so the port lands without changing the rule. A listed case that starts passing fails the test so the list is pruned.
Port php-cs-fixer's StatementIndentationFixer (bracesFixerCompatibility=false): walk block, block_signature and statement scopes and reindent each line to four spaces per nesting level, including continuation lines inside multiline calls and arrays that the previous rule left untouched. Promoted constructor parameters are not treated as property starts, so their modifiers do not stack signature scopes. Passes 83 of 86 ported php-cs-fixer cases; the 3 gated are multiline trait use (CT::T_USE_TRAIT) and the tab-indent case the harness cannot express. Mautic parity improves from 53 to 40 differing files with no regression.
…signature
A contextual keyword lexed as a keyword but used as an identifier
("Enum::MODE_ADD", "new Match", "$o->enum") no longer starts a
block_signature scope, which had stacked unpopped scopes and over-indented
the closing "]);" of an array call argument. A following "\" is a
namespace prefix on the operand ("case \Foo::BAR:") and does not count.
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.
Moves the php-cs-fixer StatementIndentationFixerTest suite into a Go table test, to pin blink's StatementIndentation behavior and scope the gap before any rule change. No rule change in this PR.
All 86 cases from
tests/Fixer/Whitespace/StatementIndentationFixerTest.phpare ported verbatim (expected, input, and thestick_comment_to_next_continuous_control_statementconfig where set). blink currently matches 27 of them.The 59 it does not yet match are gated behind a documented
stmtIndentKnownFailuresallowlist so the port stays green; a listed case that starts passing fails the test, so the list gets pruned as the rule improves. The single tab-indent case cannot be expressed through blink's test harness (no WhitespacesFixerConfig) and stays a known gap.