Repository navigation
fix(tokenizer): stop reading keyword arguments and members named function as declarations - #388
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
roxblnfk
force-pushed
the
fix/tokenizer-named-function-arg
branch
6 times, most recently
from
October 13, 2026 16:53
e6290fe to
0f38e10
Compare
…ction` as declarations The name of a function was read from the token before the next `(`, so any `function` token that declares nothing borrowed a name from later code: a named argument `f(function: $x)` followed by `if (` became a method `if`, and a constant, enum case or trait alias named `function`, or a grouped `use function` import, produced methods and functions that do not exist. A method named `function` was taken for a closure and left out. A declaration is now recognized only as `function`, an optional `&`, a name spelled as a PHP label and `(`, with comments allowed in between, and never right after `::`, where `Foo::function and ($x)` would otherwise declare `and`. Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
roxblnfk
force-pushed
the
fix/tokenizer-named-function-arg
branch
2 times, most recently
from
October 13, 2026 17:00
0f38e10 to
55df58d
Compare
Merged
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.
What was changed
function:no longer registers a phantom function or method:$this->run(function: 1); if (...)used to add a methodifto the enclosing class.functionis now found instead of being taken for a closure.function /* … */ ()) is no longer registered under the comment's text.Why?
TokenizedFilereads a function's name as the token before the next(, so anyfunctiontoken that does not declare anything picked up an unrelated name. Found while estimating executable lines for coverage, whereclass:andfunction:arguments trip the same kind of scan.Checklist