What is the correct way to display a multi-line @param using PHPDoc? What is the correct way to display a multi-line @param using PHPDoc? php php

What is the correct way to display a multi-line @param using PHPDoc?


You can simply do it this way :

 /** * * @param string $string Optional. Sends a greeting to a given noun instead. *                       Input is converted to lowercase and capitalized. * @param bool $surprise */function helloYou( $string = 'World', $surprise = false ){    $string = 'Hello ' . ucwords( strtolower( $string ) );    if( !!$surprise ) {        $string .= '!';    }    echo $string;}

So your example is fine except for one thing : the PHPDoc @param needs to have the same name as the PHP parameter. You called it $noun in the doc and $string in the actual code.