简体   繁体   English

如何为可变参数函数编写Doxygen注释,即具有未定义数量的参数的函数?

[英]How to write a Doxygen comment for variadic function, i.e., a function with undefined number of arguments?

I am trying to write a doxygen block comment for a function with unlimited number of parameters, then I couldn't find a right tag for it. 我正在尝试为具有无限数量参数的函数编写doxygen块注释,然后我找不到正确的标记。 Supplied parameters should all be strings, and they will be concatenated in the function to form a new string. 提供的参数应该都是字符串,并且它们将在函数中连接以形成新的字符串。

What is the right use of doxygen tags? doxygen标签的正确用途是什么?

A pattern I see frequently in phpdoc (the format of which doxygen understands) is: 我经常在phpdoc中看到的模式(doxygen理解的格式)是:

/** 
 * Shortdesc.
 * Longdesc.  Longdesc.  Longdesc.  Longdesc.  
 * @param mixed $something Description
 * @param mixed ... Description
 */
    function foo() { ... }

Yes, literally ... as the variable name. 是的,从字面上看...作为变量名称。

Actually, the syntax on the phpDocumentor is $paramname,... 实际上,phpDocumentor上的语法是$paramname,...

/**
 * Builds a file path with the appropriate directory separator.
 * @param string $segments,... unlimited number of path segments
 * @return string Path
 */
function file_build_path(...$segments) {
    return join(DIRECTORY_SEPARATOR, $segments);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM