【发布时间】:2016-11-07 11:39:48
【问题描述】:
我在构造函数中声明了很多属性:
public function __construct()
{
$this->foo = new Foo();
$this->poit = new Poit();
$this->narf = new Narf();
}
现在我想声明所有字段,但我似乎只能通过 Alt + Enter "Declare field" 在一个属性上一一进行。
如何声明所有字段?最好使用正确的 PHPDoc,因为当我使用声明字段时,只添加了属性而没有任何类型提示。
它应该类似于initializing all fields,但我避免为该类故意注入这些服务。
我尝试激活“未定义字段”意图,但未列出:
【问题讨论】: