Skip to content

Do not reflow eval/exit/die argument lists in blink MethodArgumentSpace - #246

Merged
TomasVotruba merged 1 commit into
mainfrom
blink-eval-construct-not-call
Oct 30, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
blink-eval-construct-not-call

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

eval, exit and die are language constructs, not function calls - PHP tokenizes them separately, so PHP-CS-Fixer's MethodArgumentSpaceFixer never reflows their parentheses.

blink lexes them as identifiers and treated eval( as a call, so a single heredoc argument was pushed onto its own line and diverged from PHP ECS. This shows up across Symfony's PhpUnit mocks (ClassExistsMock, ClockMock, DnsMock, ...) which all use eval(<<<EOPHP ... ).

Fix: exclude the three constructs from call detection unless used as a member call ($obj->eval(...), still a real call).

Adds a local parity fixture (internal/parityfixture/testdata/cases/eval_heredoc_single_arg) reproducing the divergence without cloning a corpus, plus a unit test.

eval, exit and die are language constructs, not function calls: PHP tokenizes
them separately, so PHP-CS-Fixer's MethodArgumentSpaceFixer never reflows their
parentheses. blink lexed them as identifiers and treated "eval(" as a call, so
a single heredoc argument was pushed onto its own line and diverged from ECS
(e.g. Symfony's ClassExistsMock, ClockMock, DnsMock).

Exclude the three constructs from call detection unless used as a member call
($obj->eval(...)). Adds a local parity fixture and a unit test.
@TomasVotruba
TomasVotruba merged commit 3d2f7f5 into main Oct 30, 2026
21 checks passed
@TomasVotruba
TomasVotruba deleted the blink-eval-construct-not-call branch October 30, 2026 23:05
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