Skip to content

Fix indentation of multiline ternary with dynamic member access - #171

Merged
TomasVotruba merged 1 commit into
mainfrom
blink-ternary-indentation
Oct 8, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
blink-ternary-indentation

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

A dynamic member access ($a->{$key}, Foo::{$key}) was read as a block in StatementIndentation: its { opened a scope and its } was treated as a statement terminator. In a multiline ternary like

return $this->condition
    ? $this->target->{$key}
    : $this->target;

that ended the statement early, so the : line fell back to block indentation instead of aligning with ?.

A { preceded by ->/?->/:: is now recognised as a dynamic member brace (not a block) in both the block-scope detection and the statement-end scan. Found via laravel parity; covered by a fixture.

@TomasVotruba
TomasVotruba merged commit 47a69f1 into main Oct 8, 2026
19 checks passed
@TomasVotruba
TomasVotruba deleted the blink-ternary-indentation branch October 8, 2026 18:31
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