phpdoc建议$ this-> someField的类型 [英] phpdoc suggesting type for $this->someField

查看:69
本文介绍了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:

class MyClass {

class MyClass {

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

}

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

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆