Skip to content

Space compound-assignment operators in blink binary_operator_spaces - #242

Merged
TomasVotruba merged 1 commit into
mainfrom
blink-binary-operator-compound-assign
Oct 30, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
blink-binary-operator-compound-assign

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

The laravel/symfony parity ruleset configures BinaryOperatorSpaces with default: single_space and operators: { "=>": single_space, "=": single_space }. PHP-CS-Fixer applies the default mode to ALL binary operators, including compound-assignment operators (.=, +=, etc.), unless an explicit per-operator override says otherwise.

blink did not: in modeAt, compound-assignment operators were treated as extra targets that only got spaced when explicitly listed in the config's operators map. Since the ruleset only lists => and =, blink left .= and the other compound-assigns untouched, diverging from PHP ECS.

Example of the divergence (blink left, PHP ECS right):

  • $url .='c'; -> $url .= 'c';

The fix makes compound-assignment operators follow the default mode like =, since they are always binary (never unary/reference/splat) and therefore safe to space without an explicit override. Behavior for + - * & | / % ^ << >> ** is unchanged.

@TomasVotruba
TomasVotruba force-pushed the blink-binary-operator-compound-assign branch from 95318c7 to 931e74e Compare October 30, 2026 16:40
@TomasVotruba
TomasVotruba merged commit 9e6422e into main Oct 30, 2026
20 of 21 checks passed
@TomasVotruba
TomasVotruba deleted the blink-binary-operator-compound-assign branch October 30, 2026 16:41
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