在Netbeans和phpStorm中, 这按预期工作:
public function someMethod() {
$objectA = uberEnterprisyFactory('someclassA');
/* @var $objectA TheClassA */
// $objectA-> (autocomplete for TheClassA is displayed, good)
这不是:
public function someMethod() {
$this->objectA = uberEnterprisyFactory('somemodelA');
/* @var $this->objectA TheClassA */
// $this->objectA-> (no autocomplete here, not good, $this->objectA is inferred to be null)
如何向Netbeans和/或phpStorm提取$this->someThing
类型?
答案 0 :(得分:5)
使用以下PHPDoc注释:
类MyClass {
/** * @var MyPropertyClass */ private $myProperty
}