Repository navigation
Do not reflow eval/exit/die argument lists in blink MethodArgumentSpace - #246
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
eval,exitanddieare language constructs, not function calls - PHP tokenizes them separately, so PHP-CS-Fixer'sMethodArgumentSpaceFixernever 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 useeval(<<<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.