#49807 [Opn->Csd]: Incorrect type signatures for methods

From: Date: Sat, 17 Oct 2009 14:19:46 +0000
Subject: #49807 [Opn->Csd]: Incorrect type signatures for methods
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2958@lists.php.net to get a copy of this message
ID: 49807 Updated by: salathe@php.net Reported By: jriddy at gmail dot com -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: N/A PHP Version: Irrelevant New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. The offsets have been type hinted as "mixed" since the ArrayAccess interface does not restrict the values that can be used for them. For example, one could pass a boolean, object, resource, etc. not just integer, string or null. It is up to the class implementing the interface to determine what it wants to allow. Thanks again for your documentation bug report. Previous Comments: ------------------------------------------------------------------------ [2009-10-17 14:15:49] svn@php.net Automatic comment from SVN on behalf of salathe Revision: http://svn.php.net/viewvc/?view=revision&revision=289713 Log: Corrected parameter type hints for ArrayAccess methods. Closes bug #49807 ------------------------------------------------------------------------ [2009-10-07 21:06:36] jriddy at gmail dot com Description: ------------ The type signatures for methods are misleading. All values of $offset could also be of type integer, and in the case of offsetSet, the $offset could also be null, as is standard in normal PHP array push notation: (e.g., $array[] = 'new value';). Since these methods are similar to __get() and __set(), which are guaranteed to receive a string as their first param, it is important to clearly indicated that the type for ArrayAccess methods is string|int. In addition, the type of the $value parameter for offsetSet should be mixed. Reproduce code: --------------- --- From manual page: class.arrayaccess --- ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49807&edit=1

« previous php.doc.bugs (#2958) next »