Skip to content

Resolve types of arrow function parameters used as arguments - #20

Merged
TomasVotruba merged 1 commit into
mainfrom
use-arrow-function-type-resolution
Sep 14, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
use-arrow-function-type-resolution

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Builds on rectorphp/php-parser-in-go#4, which added arrow function type resolution to the namespace resolver.

  • bumps php-parser-in-go to the version with that fix
  • the collector now tracks an arrow function's own typed parameters (merged over the captured outer scope), so a typed arrow parameter passed into a call resolves to its class
fn (Lead $lead) => $this->save($lead);
// -> save(\App\Entity\Lead $entity)

Covered by a new end-to-end test using a use import, so it exercises the upstream resolution.

Bumps php-parser-in-go to pick up its new arrow function type resolution,
and tracks arrow function parameter types in the collector so a typed arrow
parameter passed into a call is qualified from the file's use imports. Outer
variables captured by the arrow are kept.
@TomasVotruba
TomasVotruba enabled auto-merge (squash) September 14, 2026 17:25
@TomasVotruba
TomasVotruba merged commit 62e5fc7 into main Sep 14, 2026
1 check passed
@TomasVotruba
TomasVotruba deleted the use-arrow-function-type-resolution branch September 14, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant