Re: [RFC] DocComments For Function Parameters
| From: | Larry Garfield | Date: | Thu, 26 Feb 2026 20:17:17 +0000 |
| Subject: | Re: [RFC] DocComments For Function Parameters | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130178@lists.php.net to get a copy of this message | ||
On Tue, Feb 24, 2026, at 6:18 PM, Christian Schneider wrote:
> Am 24.02.2026 um 21:53 schrieb Christian Schneider <cschneid@cschneid.com>:
>> Am 24.02.2026 um 20:13 schrieb Larry Garfield <larry@garfieldtech.com>:
>>> 1. As Matthew said, putting the doc comment after the parameter is inconsistent.
>>> I've... never actually seen someone do that. I have seen people put doc comments on the line
>>> before a parameter (which I then had to move to the function docblock, which was annoying). Every
>>> other docblock-able construct has the docblock as a prefix, not suffix. It should be a prefix here
>>> as well.
>>
>> Just to clarify: You can write it before, in the middle or after the parameter, just like
>> you can write it before or in the middle of properties.
>> The proposal allows pre, middle and post styles.
>
> I changed the example to use the standard docblock-before variant and
> added a separate example to explain the option to put the comments
> behind the parameter definition:
> https://wiki.php.net/rfc/parameter-doccomments#example
>
> Regards,
> - Chris
Huh. I had no idea that a suffix was possible for properties at all. I've literally never
seen that. TIL.
Given that, and that the RFC is now promoting the prefix style, I am now in support.
One additional note: In the updated suffix section, it would be good to note that is similar to
properties, which already support a suffix even if it's hardly ever used. I think it's
likely that many others also don't realize it's already possible. Also, there's a
missing period after "next parameter." :-)
--Larry Garfield