Re: Callback prototypes
| From: | Hannes Magnusson | Date: | Fri, 03 Feb 2012 05:24:09 +0000 |
| Subject: | Re: Callback prototypes | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969383608@lists.php.net to get a copy of this message | ||
On Fri, Feb 3, 2012 at 01:49, Justin Martin <frozenfire@php.net> wrote:
> Hello everyone,
>
> I'd like to propose using the methodsynopsis format for callback prototypes,
> on function references such as that for array_reduce.
>
> <varlistentry>
> <term><parameter>function</parameter></term>
> <listitem>
> <para>
> The callback function.
> </para>
> <methodsynopsis>
> <type>void</type><methodname>callback</methodname>
> <methodparam><type>array</type><parameter
> role="reference">result</parameter></methodparam>
>
> <methodparam><type>mixed</type><parameter>item</parameter></methodparam>
> </methodsynopsis>
> </listitem>
> </varlistentry>
>
> This is rendered as such in the current styling of the online documentation:
> http://i.imgur.com/cUAPt.png
>
> Any objections? If we decide upon this format, I'd also go ahead and update
> any existing documentation on functions that use callbacks.
I don't think its as simple as that. You still need to document the
params, return values and stuff, which can often be whole lot of info.
How would http://no2.php.net/manual/en/function.session-set-save-handler.php
for example become?
We have in somecases simply documented the callback as a "real"
function, like http://no.php.net/manual/en/function.stream-notification-callback.php
I think I am more fan of that approach.
-Hannes