如何doc可变数量的参数

时间:2010-08-28 10:42:14

标签: php javascript phpdoc jsdoc

如何记录可变数量的参数?我正在用PHP和JavaScript编写应用程序。目前我有(在JavaScript中):

/**
 * Description
 * @param {String} description
 */
function fn()
{
  // arguments holds all strings.
}

那么,我该如何编写n个字符串参数?

1 个答案:

答案 0 :(得分:12)

E.g。 PhpDocumentor建议使用省略号

/**
 * Example of unlimited parameters.
 * Returns a formatted var_dump for debugging purposes
 * (since the recurrences of $v are not listed in the actual function signature in the code,
 * you may wish to highlight they are "optional" in their description)
 * @param string $s string to display
 * @param mixed $v variable to display with var_dump()
 * @param mixed $v,... unlimited OPTIONAL number of additional variables to display with var_dump()
 */
function fancy_debug($s,$v)
{