Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to infer type for method completion? #109

Open
Slamdunk opened this issue Jul 6, 2021 · 0 comments
Open

How to infer type for method completion? #109

Slamdunk opened this issue Jul 6, 2021 · 0 comments

Comments

@Slamdunk
Copy link
Contributor

Slamdunk commented Jul 6, 2021

Hi, implementing a custom \Phpactor\WorseReflection\Core\Inference\FrameWalker I've been able to infer a custom type to a variable during assignment:

/** @var MyContainer $container */

$foo = $container->get(MyService::class);
<> // $foo is now MyService just like I need it to be

Now I'm looking for doing the same at direct call level:

/** @var MyContainer $container */
$container->get(MyService::class)-><> // MyService ordinary completion should pop up

But I fail to understand the proper way to do it.
I've dug into FrameWalker and also WorseClassMemberCompletor: I don't need to create a custom properties/methods list, I'm just looking for inferring MyServce type as the return type of the get method.

Any help or hint would be lovely welcomed.

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

No branches or pull requests

1 participant