phpactor: [WR] Docblock type hinting with FQN

        /** @var \Phpactor\WorseReflection\Core\Inference\SymbolInformation $bar */
        $bar = $baz;
        $bar->

does not work, but importing SymbolInformation is fine.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 25 (3 by maintainers)

Most upvoted comments

Feel free to re-open if this is still an issue or I misunderstood.

Not sure if this is related, but I had something like this:

class FooController
{
    /** @var App\User $user */
    protected $user;
}

When I tried auto completing $this->user-> I would get Could not find class "App\Http\FooController\App\User", but if I then imported the User class at the top everything worked as expected.

Created https://github.com/phpactor/worse-reflection/pull/24/files

Trying to replace this code, but this is a quick fix.

Kind of related (I think):

<?php
namespace Acme\Bar;

use Acme\Foo;

class Qux
{
    /** @var Foo\Bar */
    private $bar;

    public function __construct(Foo\Bar $bar)
    {
        $this->bar = $bar;
    }
}

Here, neither $this->bar nor $bar in the constructor are recognized as Acme\Foo\Bar. So basically, it doesn’t support namespace imports use Acme\Foo; (while it supports FQCN \Acme\Foo\Bar or class imports use Acme\Foo\Bar;).