即使在Ctrl + Space之后,PhpStorm也不会显示自动完成功能

问题描述

我正在symfonycasts.com上学习使用Symfony进行编码,并正在使用PHPStorm。

Doctrine\ORM\EntityManagerInterface服务不会加载getRepository()->个建议。

这是我应该看到的键入getRepository()的内容

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

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

这就是我看到的:

(1)This is what I see

(2)This is what I see

其他自动完成库似乎运行良好。

解决方法

找到一种解决方法:可以通过使用变量上方的@var注释来提示IDE该对象可以属于哪个类,例如:

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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...