Blink parity: array reflow for casts and destructuring - #131
Merged
Merged
Conversation
isArrayLiteralOpen rejected a "[" preceded by ")" as a call-result index access, but "(object) [...]" (or any cast) opens an array literal, so ArrayListItemNewline now splits it one item per line like php engine.
A single-line "[$a => ..., ...] = $x" destructuring target was expanded onto multiple lines by the three Symplify array-newline fixers. php-cs-fixer tags it as destructuring, not an array literal, so each now skips it.
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.
Two array-reflow parity fixes on mautic/mautic. Measured drop: 61 to 53 differing files of 4527.
Cast-prefixed arrays
isArrayLiteralOpenrejected a[preceded by)as a call-result index access (foo()[0]), but a cast opens an array literal:(object) [...],(array) [...]. The reflow fixers now split such an array one item per line, matching the PHP engine. Biggest single win here (~6 files, the(object) [...]test pattern).Destructuring targets
A single-line
['a' => $x, 'b' => $y] = $sourcedestructuring target was expanded onto multiple lines by the three Symplify array-newline fixers (ArrayListItemNewline, ArrayOpenerAndCloserNewline, StandaloneLineInMultilineArray). php-cs-fixer tags it as destructuring, not an array literal, so each now skips a[whose matching]is directly followed by=.Unit tests cover the cast-array split and the call-result-access no-op.