A few questions regarding doc comments

  1. Is there a list of supported @params? I just discovered @see seems to work, but I'm not sure what the proper syntax is to @see multiple functions
  2. How can I specify that a function takes a variable number of arguments? i.e., if I get the args with func_get_args(). Is this supported? If not, can you add support? :)
1 comment
Comment actions Permalink

Hi Mark,

1) There is no special list. You better ask specific questions about specific tag as PhpStorm's support for each such tag can be different/incomplete from original PHPDoc (please check existing tickets on Issue Tracker for existing issues).

The following works:

/**
* Some function
*
* @see anotherMethod
* @see someClass
*/

As well as this:

/**
* Some function
*
* @see anotherMethod,  someClass
*/


There is one issue in v3.0, that affects how multiple @see links displayed in Quick Documentation popup (although links do work correctly when clicked): http://youtrack.jetbrains.net/issue/WI-8879

2) Accordingly to PHPDoc manual the following can be used: @param mixed $v,... unlimited OPTIONAL number of additional variables . Unfortunately that is not supported by PhpStorm.

In PhpStorm you just provide at lest one parameter description and when calling such function with more parameters than declared, PhpStorm will not give any warning:

/**
* Some function to test
*
* @param mixed $param Function parameter (any number of parameters)
*/
function testMe($param)
{
    // do something useful here    
}



testMe('first', 'second', 'third');


Or just see how it is implemented for existing function that supports unlimited number of parameters, e.g. var_dump() :

/**
* (PHP 4, PHP 5)<br/>
* Dumps information about a variable
* @link http://php.net/manual/en/function.var-dump.php
* @param mixed $expression <p>
* The variable you want to export.
* </p>
* @param mixed $expression [optional]
* @return void
*/
function var_dump ($expression, $expression = null) {}

0

Please sign in to leave a comment.