[英]Annotate a class member that doesn't exist (virtual property)
有没有办法为未明确声明的类成员添加注释? 喜欢
class Foo
{
/** @var string $bar */
// public $bar; // <--- without this line
...other stuff...
}
背景:我使用__get
为类提供虚拟属性,并希望这些属性显示在phpstorm / idea自动完成框中。
在类上使用@property
*批注。
/**
* @property string $bar
*/
class Foo {}
*或@property-read
或@property-write
视情况而定)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.