Repository navigation
feat: Named arguments follow the parameter they name - #548
Open
AbyssWaIker wants to merge 3 commits into
Open
AbyssWaIker wants to merge 3 commits into
AbyssWaIker wants to merge 3 commits into
Conversation
AbyssWaIker
force-pushed
the
name_param
branch
from
November 7, 2026 16:53
0455025 to
881b508
Compare
Renaming a variable no longer rewrites the labels of a parameter it shadows: the parameter lookup now shares the variable search's declaring-scope walk. Parameter label searches filter by callee name before resolving, which removes a workspace-wide forward walk from every parameter reference request. A label resolves its class by exact FQN, so #[\Tag] next to a local App\Tag lands on the global one. The deprecated-usage arm for labels, which could never fire, is gone. Unknown named arguments are now reported for callees that read func_get_args(), as PHP does. Filed B735 for find_class_file_uri's short-name match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AbyssWaIker
force-pushed
the
name_param
branch
2 times, most recently
from
November 7, 2026 17:37
84cf0df to
fac1a6d
Compare
Contributor
Author
|
Sorry for all the force pushes. Did not notice pressing "create PR" too early and thought I was still free to mess around with the branch (while rebasing it) without inconveniencing anyone Should be ready now |
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This branch has not been deployed
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.
A named argument's label —
name:innew SelectField(name: 'x'), in$field->render(name: 'x'), or in an attribute like#[Field(name: 'x')]— is the only place a parameter's name is written outside the parameter's own declaration. This PR makes it behave like that declaration everywhere the editor asks about a name.Go-to-definition lands on the parameter's
$nametoken, which for a promoted constructor parameter is where the property is declared. Hover shows the promoted property, or the parameter's signature with its type,its
&and...marks, its default, and its@paramtext. Document highlights light up the declaration, its accesses, and the labels that fill it, in both directions. Find-references gathers the labels across theworkspace alongside the same-named accesses, and a search started from a label answers with its parameter's references; a promoted property whose only other spelling is a label at a constructor call is no longer a symbol
nothing uses. Rename moves every spelling together —
$name,->name, and the label at each call that passes it a value by name — while a label of the same name at a different callee stays put, and a property the parameter does not promote is left out.The symbol map records each label as a
NamedArgumentspan pointing back at its call site, andcall_resolution/named_arguments.rsresolves the call's target to the parameter the label binds. Two labels name the same parameter when their declarations land on the same bytes, so an inherited constructor shares the parent's token while an override keeps its own; trait and interface methods resolve through their declaring class, and aglobal helper called from namespaced code is found through PHP's own lookup fallback. This replaces the
AttributeNamedArgmember-access special case that attribute labels previously carried, and labels at abuilt-in's stub — a declaration the engine reads but cannot show — hover and type as their parameter while declining navigation and rename rather than entering rename mode to produce no edits.
The
unknown_named_argumentcheck lands on the label spans and is rewired onto this resolution, refining main's version: afunc_get_args()callee still rejects a label its signature does not declare, while a method routed through__callor synthesized from an@methodtag, and a name read from a callable type, are exempt; at a built-in, a label that differs from a declared parameter only in case or underscores is forgiven, since the bundled stubs spell some parameters otherwise than the runtime's arginfo does. Extensions php-src does not ship remain unchecked until their stub names are corrected (D44).A label that fills a deprecated promoted property now reports the deprecation the way
->namedoes.Checklist
If applicable:
CHANGELOG.mdREADME.md,docs/,examples/)config-schema.json)the changes and why they are needed.
the changelog, and other user-facing content, and removed or corrected
anything inaccurate, unclear, or unnecessary.