Skip to content

Blink parity: semicolon, bracket-comment, float, destructuring - #130

Merged
TomasVotruba merged 5 commits into
mainfrom
tv-blink-parity-small-buckets
Oct 4, 2026
Merged

TomasVotruba merged 5 commits into
mainfrom
tv-blink-parity-small-buckets

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Four isolated blink parity fixes on mautic/mautic, each verified against the PHP engine with no regression. Measured drop: 72 to 65 differing files of 4527.

Empty for condition spacing

SpaceAfterSemicolon now inserts a space after a ; that is followed by another ; (the empty condition of a for() header), suppressing it only before ). NoSinglelineWhitespaceBeforeSemicolons keeps that space when the preceding token is itself a ;. Matches php-cs-fixer for ($i = 0; ; ++$i).

Space before a trailing comment

SpacesInsideParentheses and TrimArraySpaces kept removing the single-line space between a bracket and a comment (if ( // note, [ // note). php-cs-fixer leaves it, so both now skip an adjacent comment token.

Leading-dot float

The lexer now reads .1 as one DNUMBER, mirroring PHP's context-free scanner. It was split into . and 1, so a concat-spacing rule turned + .1 into + . 1.

Destructuring commas

php-cs-fixer tags [$a,$b] = ... as destructuring, not an array, so WhitespaceAfterCommaInArray leaves its commas alone. The bracket stack now marks a destructuring [ (matching ] followed by =, or nested in one).

php-cs-fixer's SpaceAfterSemicolon inserts a space after a ";" that is
followed by another ";" (the empty condition of a for() header), only
suppressing it before ")". NoSinglelineWhitespaceBeforeSemicolons must
then leave that space alone when the preceding token is itself a ";".
SpacesInsideParentheses and TrimArraySpaces removed the single-line space
next to a comment ("if ( // note", "[ // note"); php-cs-fixer leaves it,
so guard both against an adjacent comment token.
PHP's context-free scanner matches ".1" as a single DNUMBER; blink split
it into "." and "1", so a concat-spacing rule turned "+ .1" into "+ . 1".
php-cs-fixer tags "[$a,$b] = ..." as destructuring, not an array, so
WhitespaceAfterCommaInArray leaves its commas alone. Track a destructuring
"[" (matching "]" followed by "=", or nested in one) on the bracket stack.
@TomasVotruba
TomasVotruba force-pushed the tv-blink-parity-small-buckets branch from 031232b to ecadd95 Compare October 4, 2026 05:54
@TomasVotruba
TomasVotruba merged commit 43fb992 into main Oct 4, 2026
18 checks passed
@TomasVotruba
TomasVotruba deleted the tv-blink-parity-small-buckets branch October 4, 2026 09:54
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