[英]NetBeans 8.1 (on Mac OS) PHP Autocompletion with $this->var does not work
Strange autocomplete behaviour: 自动完成行为异常:
class myFirstClass
{
public function myFunc1() {}
public function myFunc2() {}
}
class mySecondClass
{
/**
* @return myFirstClass
*/
public function getMyFirstClass()
{
return new myFirstClass();
}
public function init()
{
$myFirstClass = new myFirstClass();
$myFirstClass-> // autoComplete works here and shows myFunc1 and myFunc2
$this->myFirstClass = new myFirstClass();
$this->myFirstClass-> // autoComplete does not work here
$this->getMyFirstClass()-> // autoComplete works here and shows myFunc1 and myFunc2
$this->myFirstClass2 = $this->getMyFirstClass();
$this->myFirstClass2-> // autoComplete does not work here
$this->myFirstClass2->myFunc1(); // cmd+click on myFunc1() in this line jumps to the myFunc1-function in myFirstClass, so netbeans "knows" the right class, but doesn't autocomplete :(
}
}
Without the $this the Code-Autocomplete works as supposed, but with $this-> it shows nothing anymore. 如果没有$ this,代码自动完成功能将按预期方式运行,但是有了$ this->,它将不再显示任何内容。 Is this a known NetBeans bug or is there a setting to fix this?
这是一个已知的NetBeans错误,还是可以解决此问题的设置?
I guess NetBeans only has an autocompletion for $this->....
, not for $this->....->....
, so it has no support for anything after the first arrow. 我猜NetBeans仅具有
$this->....
$this->....->....
的自动补全功能,而没有$this->....->....
的自动$this->....->....
,因此它在第一个箭头之后不支持任何功能。 You're correct it's not working, because it isn't intended to. 您是正确的,它不起作用,因为它不是故意的。
Regards. 问候。
Please add fields to your mySecondClass: 请向您的mySecondClass添加字段:
class mySecondClass {
private $myFirstClass;
private $myFirstClass2;
}
or 要么
class mySecondClass {
/**
* @var myFirstClass
*/
private $myFirstClass;
/**
* @var myFirstClass
*/
private $myFirstClass2;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.