Search code examples
phpphpdoc

Avoid error 'Parameter $arg could not be found in method()' on variable arguments methods on phpDocumetor


I've been recently documenting my classes, and one of them has a method with no arguments in its definition, but because I parse them with get_func_args(). Let me show you:

public function method()
{
    if(func_num_args() == 2)
    {
        //...
    }
}

The problem's that when I document it, I want to add which arguments it receives. Something like this:

/**
* Some info
* @param string $arg Some value
* @param mixed $arg2 Some value
*/

Before asking, I do this with the get_func_args() stuff because it extends an abstract class, whose arguments differ a little from each implementation.

When I document this class, it pops a notice:

Parameter $arg could not be found in method()

Any way to avoid this, or to tell phpDocumentor that this class has in fact some parameters?


Solution

  • I think you'll have to review your architecture and match arguments in abstract and children classes, because PHPDoc seems to be strict about parameters given in annotations.