Skip to content

De-yoda comparisons whose variable side is a parenthesized primary - #170

Merged
TomasVotruba merged 1 commit into
mainfrom
blink-yoda-grouped-primary
Oct 8, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
blink-yoda-grouped-primary

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

YodaStyle (non-yoda, ECS config) left a comparison like null !== (new static($a))->user() untouched because the right side starts with (, which blink treated as a non-variable group. But (new X())->y() is a parenthesized primary with a method call - a variable expression php-cs-fixer de-yodas.

Now the group is only skipped when it spans the entire operand (a pure (...) group); when it is the base of a larger primary ((...)->y(), (...)[0]) the comparison is de-yoda'd, matching ECS. Found via laravel parity (RequestGuard). Covered by a fixture.

@TomasVotruba
TomasVotruba enabled auto-merge (squash) October 8, 2026 17:45
@TomasVotruba
TomasVotruba merged commit 4efc7c5 into main Oct 8, 2026
19 checks passed
@TomasVotruba
TomasVotruba deleted the blink-yoda-grouped-primary branch October 8, 2026 17:47
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