How can I specify array of objects in PhpDoc [duplicate]

假如想象 提交于 2019-12-01 17:07:11

问题


Possible Duplicate:
PHPDoc type hinting for array of objects?

I use PhpDocumentor2 for generating documentation. I searched for this subject but I can't find specific rule for it. For Example I have class which name is AddressField and I want to specify my $addressFields as array of AddressField objects.

/**
 * @var AddressField[]
 */
private $addressFields;

回答1:


phpdoc themselves describe the use of arrays here:

1.4.4. Arrays

  • undefined: @return array
  • single type: @return int[]
  • multi type: @return (int|string)[]

The same should apply to variable definitions:

/* @var $arr Type[] */


来源:https://stackoverflow.com/questions/13455473/how-can-i-specify-array-of-objects-in-phpdoc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!