Skip to content

Fix blink YodaStyle skipping a comparison after a block's closing brace - #241

Merged
TomasVotruba merged 1 commit into
mainfrom
worktree-agent-a7ecc37218b34e01a
Oct 30, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
worktree-agent-a7ecc37218b34e01a

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Problem

blink's YodaStyle left null === $delay unchanged where ECS swaps it to $delay === null, when the comparison is the condition of a (multiline) ternary that starts right after a preceding block:

if ($job) {
    // ...
}

null === $delay
    ? $connection->pushOn(enum_value($queue), $job)
    : $connection->laterOn(enum_value($queue), $delay, $job);

Seen in src/Illuminate/Events/Dispatcher.php (Laravel corpus), where ECS applies Yoda style but blink did not.

Cause

isLeftBoundary recognised { but not } as a left boundary. A statement can begin directly after a block's closing brace (e.g. the } of a preceding if {...}), so the left literal operand's preceding } failed the boundary check and the swap was skipped. In isolation the comparison swapped fine; only the preceding } triggered the miss.

Fix

Add } to the left-boundary punctuation set. A } closes a preceding block, so a literal immediately after it starts a new statement and is a standalone comparison operand.

Validation

  • New focused unit test for a multiline ternary condition after a block's }.
  • 6 previously known-failing php-cs-fixer parity cases (178-183, all of this shape) now pass and were removed from the known-failures list.
  • blink and ECS now produce identical output on the full Dispatcher.php corpus file - the $delay === null line matches with no new diffs.
  • CI gates pass: gofmt -s -l ., go vet ./..., go test -race ./..., golangci-lint run.

@TomasVotruba
TomasVotruba merged commit cbff64f into main Oct 30, 2026
21 checks passed
@TomasVotruba
TomasVotruba deleted the worktree-agent-a7ecc37218b34e01a branch October 30, 2026 16:40
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