0
中记录允许的数组参数值我经常将一个数组作为构造函数参数传递。我应该如何记录允许的值?我尝试了一些样式,但在phpdoc中看起来有点乱。我应该如何在php
中记录允许的数组参数值我经常将一个数组作为构造函数参数传递。我应该如何记录允许的值?我尝试了一些样式,但在phpdoc中看起来有点乱。我应该如何在php
真的是用于记录哈希阵列没有“官方” 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){
}
我想这可能是最好明确定义要接受,而不是传递一个数组哪些参数。 – Lix
如果您有很多参数,请考虑构建一个单独的对象。 –