phpdoc-parser icon indicating copy to clipboard operation
phpdoc-parser copied to clipboard

[PSR-5] param tag with optional values

Open jaapio opened this issue 3 years ago • 0 comments

The param requires a paramname, however, this could be omitted when the param tag is describing just a single argument method or all other params are adequately documented. For example:

/**
 * @param int
 * /
 public function foo($arg): void 
{}
/**
 * @param int $arg
 * @param int Optional description
 * /
 public function foo($arg, $second): void 
{}

I do see this as edge cased, but it makes makes more sense when you align this with other tags for example the @var tag. Which has the same behavior.

class Foo {
    /** @var int */
   public $bar
}
class Foo {
    /** 
     * @var int
     * @var string $foo
     */
   public $bar $foo
}

I'm working on a pr to support this.

jaapio avatar Nov 15 '22 21:11 jaapio