I would like to introduce DocComment support for function parameters:
https://wiki.php.net/rfc/parameter-doccomments
Regards,
- Chris
On Sat, Feb 21, 2026, 11:52 AM Christian Schneider cschneid@cschneid.com
wrote:
I would like to introduce DocComment support for function parameters:
I've been wanting this for nearly 20 years!
Questions:
-
Would it also support the comment appearing before the parameter?
/** This is the description */
string $message, -
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? */,
Generally, docblocks precede the item being documented, so if only one form
were allowed, for consistency, that should be the form supported.
--
Matthew Weier O'Phinney
mweierophinney@gmail.com
https://mwop.net/
he/him
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