本文介绍了phpdoc建议$ this-> someField的类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Netbeans和phpStorm中,可以按预期运行:

In Netbeans and phpStorm,this works as expected:

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)

如何将$this->someThing类型归为Netbeans和/或phpStorm?

How can I sugest type of $this->someThing to Netbeans and/or phpStorm?

推荐答案

使用以下PHPDoc注释:

Use the following PHPDoc annotation:

/**
 * @var MyPropertyClass
 */
private $myProperty

}

这篇关于phpdoc建议$ this-> someField的类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 01:06