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

Improve autocompletion for ::class constants #165

Open
hason opened this issue Nov 25, 2019 · 3 comments
Open

Improve autocompletion for ::class constants #165

hason opened this issue Nov 25, 2019 · 3 comments

Comments

@hason
Copy link

hason commented Nov 25, 2019

For Doctrine annotations I prefer use ::class constants over strings:

namespace App\Entity;

use App\Entity\User;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity()
 */
class Post
{
    /**
     * @ORM\ManyToOne(targetEntity=User::class, inversedBy="posts")
     */
    private $author;
}

Unfortunately, the autocompletion for properties (posts) doesn't work in this case.

I would like to set in Settings whether I prefer constants or strings.

@King2500
Copy link
Contributor

I suggest that both ways should work automatically, without any settings.

@Haehnchen
Copy link
Owner

posts should for fix latest changes on the Symfony plugin.

"::class" made it into Symfony maker bundle; maybe this should be also reflected here

@pkly
Copy link

pkly commented Jun 4, 2020

What I noticed is that if you ctrl+hover over a class declaration like MyClass::class, for example in Doctrine's targetEntity argument, it will correctly link it to the MyClass class, but ONLY if that class was imported with PHP's use statement in the file.
If the class is within the same namespace and was not imported, as it's not necessary it will not be linked.

Haehnchen added a commit that referenced this issue Jun 7, 2020
…mespace

support class constant navigation on same namespace and refactor import scope usage #165
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

4 participants