#48119 [Ana]: usort() docs don't mention it now takes a lambda
| From: | philip@php.net | Date: | Sat, 02 May 2009 03:50:44 +0000 |
| Subject: | #48119 [Ana]: usort() docs don't mention it now takes a lambda | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-2186@lists.php.net to get a copy of this message | ||
ID: 48119
Updated by: philip@php.net
Reported By: schwern at pobox dot com
Status: Analyzed
Bug Type: Documentation problem
PHP Version: Irrelevant
New Comment:
The analysis here looks good.
Previous Comments:
------------------------------------------------------------------------
[2009-05-02 03:33:21] schwern at pobox dot com
If you're going to go with that method, which is fine, the docs need a
few things to support it.
1. The docs on the callback type have to document it. Currently it
does not. It says "A PHP function is passed by its name as a string."
There's no mention of being able to use a lambda in 5.3.0.
http://www.php.net/manual/en/language.pseudo-types.php#language.types.callback
2. Remove any mentions of the new 5.3.0 callback syntax from specific
function documentation, such as array_map. The fact that array_map()
documented it and usort() did not suggested it was an exceptional case.
------------------------------------------------------------------------
[2009-05-02 02:00:43] kalle@php.net
All functions that accept a callback can make use of lambda style
functions, I don't think its worth adding to every single function that
takes a callback parameter that as of 5.3 its possible to pass a closure
there. I'll leave this to one of the other doc-geeks to decide.
------------------------------------------------------------------------
[2009-04-29 23:58:58] schwern at pobox dot com
Description:
------------
The documentation for array_map() mentions...
5.3.0 It is now possible to use a lambda function as the callback.
That's nice to know. usort() does not mention this, nor does it have
any examples showing it off. It would be nice if it did.
I had to compile up 5.3.0 to check that it did, in fact, work. There
also appear to be no tests for this in ext/standard/tests/array/usort*
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48119&edit=1