从我所做的研究,我似乎找不到一个正确的方法来格式化多行phpdoc @param行。推荐的方法是什么?
以下是一个例子:
/**
* Prints 'Hello World'.
*
* Prints out 'Hello World' directly to the output.
* Can be used to render examples of PHPDoc.
*
* @param string $noun Optional. Sends a greeting to a given noun instead.
* Input is converted to lowercase and capitalized.
* @param bool $surprise Optional. Adds an exclamation mark after the string.
*/
function helloYou( $noun = 'World', $surprise = false ) {
$string = 'Hello ' . ucwords( strtolower( $string ) );
if( !!$surprise ) {
$string .= '!';
}
echo $string;
}
这是否正确,还是不能添加缩进,还是将所有内容都放在一条长线上?