【发布时间】:2012-09-09 05:32:06
【问题描述】:
我经常将数组作为构造函数参数传递。我应该如何记录允许值?我尝试了一些样式,但它们在 phpdoc 中看起来有点乱。
【问题讨论】:
-
我认为明确定义要接收的参数可能比传递数组更好。
-
如果您有很多参数,请考虑构建一个单独的对象。
标签: php documentation phpdoc
我经常将数组作为构造函数参数传递。我应该如何记录允许值?我尝试了一些样式,但它们在 phpdoc 中看起来有点乱。
【问题讨论】:
标签: php documentation phpdoc
确实没有“官方”的 phpdoc 方法来记录散列数组,但这里有一种方法:
/**
* @param array $options hash of standard options for this class:
* int id the id of whatever object
* string name name of whoever it is
* array sub_option hash of sub options:
* int num number description for this index
* bool is_good should we do this or not?
*/
function __construct( $options ){
}
【讨论】: