Doc #52878 [Ana]: Incorrect return type
| From: | jon at phpsitesolutions dot com | Date: | Mon, 20 Sep 2010 15:43:46 +0000 |
| Subject: | Doc #52878 [Ana]: Incorrect return type | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-5091@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52878&edit=1
ID: 52878
User updated by: jon at phpsitesolutions dot com
Reported by: jon at phpsitesolutions dot com
Summary: Incorrect return type
Status: Analyzed
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
Assigned To: markskilbeck
Block user comment: N
New Comment:
Whichever is the correct approach, I leave up to better minds @php.net
(such as
yourselves) to decide.
The main issue is to ensure that the "void" return type is corrected to
at least
array or mixed, as either would be more accurate than "void".
Just a suggestion regarding the array vs mixed debate, there does seem
to be a
definite inconsistency across PHP docs, so it would be nice to see a
decision
and then likely a process would need to be put in place to review the
return
types going forward, to make consistent?
Or maybe I'm just overthinking things :-)
Cheers
Previous Comments:
------------------------------------------------------------------------
[2010-09-20 12:42:15] markskilbeck@php.net
Hi, Phillip.
I wasn't aware that only the success value should be documented. Anyway,
most of the documentation I've seen shows functions that return FALSE on
failure and any other value on success as a mixed return. This makes
sense to me. However, getMultiByKey does return FALSE only on error, it
seems.
------------------------------------------------------------------------
[2010-09-19 17:19:28] philip@php.net
Technically it should be 'array' and not 'mixed' as otherwise every
method/function in the manual would be 'mixed'. The prototype includes
what may
happen on success.
That is, unless false is returned when no items are found (as opposed to
some
error or fail). I assume an empty array is returned in that case but if
not then
mixed is perfect. Either way, it could be clarified.
------------------------------------------------------------------------
[2010-09-19 15:35:54] markskilbeck@php.net
I've updated the documentation to reflect your suggestion.
------------------------------------------------------------------------
[2010-09-19 14:48:12] markskilbeck@php.net
Automatic comment from SVN on behalf of markskilbeck
Revision: http://svn.php.net/viewvc/?view=revision&revision=303569
Log: #52878 - fixes return type
------------------------------------------------------------------------
[2010-09-18 06:21:49] jon at phpsitesolutions dot com
Description:
------------
http://us.php.net/manual/en/memcached.getmultibykey.php
The docs state that the return type is void (public void
Memcached::getMultiByKey), but then in the actual return description, it
states
Array or False, which would be "mixed".
This affects the overall docs page for Memcached, as well as the
specific function
description page.
There are other occurrences such as this one in the Memcached docs as
well....
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52878&edit=1