phpdoc 建议 $this->someField 的类型



在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

}

相关内容

  • 没有找到相关文章

最新更新