..当变量是$ this->成员时。
例如:
/ * @var $ this-> myObject MyClass * /
不起作用。
/ * @var $ foo SomeOtherClass * /
作品。
$ this会员需要什么特殊编码?
(另见http://netbeans.org/kb/docs/php/php-variables-screencast.html)
答案 0 :(得分:2)
您可以对类变量进行类型设置,但您必须在定义它们的位置执行此操作。每个例子:
<?php
class Foo {
function bar( ) {
return 'foo-bar';
}
}
class Bar {
/**
* Contains a Foo.
* @var Foo
*/
protected $foo;
public function foobar( ) {
return $this->foo; /** Here, you'd get autocompletion when you add ->. */
}
}