Skip to content

Blink parity: array reflow for casts and destructuring - #131

Merged
TomasVotruba merged 2 commits into
mainfrom
tv-blink-parity-array-reflow
Oct 4, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
tv-blink-parity-array-reflow

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Two array-reflow parity fixes on mautic/mautic. Measured drop: 61 to 53 differing files of 4527.

Cast-prefixed arrays

isArrayLiteralOpen rejected 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] = $source destructuring 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.

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.
@TomasVotruba
TomasVotruba merged commit c48febb into main Oct 4, 2026
18 checks passed
@TomasVotruba
TomasVotruba deleted the tv-blink-parity-array-reflow branch October 4, 2026 18:51
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