Skip to content

How to infer type for method completion? #109

Description

@Slamdunk

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions