Gediminas
Gediminas

Reputation: 87

PhpStorm doesn't show autocomplete even after Ctrl+Space

I am learning to code with Symfony in symfonycasts.com and am using PhpStorm.

Doctrine\ORM\EntityManagerInterface service doesn't load getRepository()-> suggestions.

This is what I should see typing getRepository():
(1)This is what I should see typing getRepository()

(2)This is what I should see typing getRepository()

This is what I see:
(1)This is what I see

(2)This is what I see

Other autocomplete libraries seems to be working well.

Upvotes: 1

Views: 208

Answers (2)

Jaroslav Kuba
Jaroslav Kuba

Reputation: 66

Phpstorm seems to have issue with the EntityManagerInterface, when I use the specific type EntityManager instead of interface, the suggestions start working again.

Upvotes: 0

Gediminas
Gediminas

Reputation: 87

Found one way to fix it : it's possible to hint IDE which class is that object can by using @var annotation above the variable, e.g.:

/** @var \App\Repository\QuestionRepository $repository */ 
$repository = $entityManager->getRepository(Question::class); 
$repository-> // now you should have autocomplete here :)

Upvotes: 1

Related Questions