在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
的类型?
使用以下PHPDoc注释:
class MyClass{
/** * @var MyPropertyClass */ private $myProperty
}