Re: [RFC] DocComments For Function Parameters
| From: | Christian Schneider | Date: | Sat, 21 Feb 2026 19:46:17 +0000 |
| Subject: | Re: [RFC] DocComments For Function Parameters | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130123@lists.php.net to get a copy of this message | ||
Am 21.02.2026 um 19:41 schrieb Matthew Weier O'Phinney <mweierophinney@gmail.com>:
> - Would it also support the comment appearing before the parameter?
>
> /** This is the description */
> string $message,
Yes, this works.
> - If so, what would be the behavior of the engine if a docblock was present in both positions,
> like:
>
> /** This is the description */
> $message
> /** But what about this? */,
The last DocComment wins, the same as for the current
class A
{
/** a */ public /** b */ int /** c */ $property /** d */;
}
echo (new ReflectionClass('A'))->getProperties()[0]->getDocComment();
This outputs the last one (/** d */), see https://3v4l.org/PZFHD
Regards,
- Chris