#49631 [Opn->Csd]: Documentation of ReflectionFunctionAbstract::getParameters return value

From: Date: Fri, 02 Oct 2009 20:47:11 +0000
Subject: #49631 [Opn->Csd]: Documentation of ReflectionFunctionAbstract::getParameters return value
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2872@lists.php.net to get a copy of this message
ID: 49631 Updated by: fa@php.net Reported By: julien_picalausa at yahoo dot fr -Status: Open +Status: Closed Bug Type: Documentation problem 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. Previous Comments: ------------------------------------------------------------------------ [2009-10-02 20:46:50] svn@php.net Automatic comment from SVN on behalf of fa Revision: http://svn.php.net/viewvc/?view=revision&revision=289098 Log: changed return value from ReflectionParameter to array - fix #49631 ------------------------------------------------------------------------ [2009-09-22 18:52:47] julien_picalausa at yahoo dot fr Description: ------------ The documentation of ReflectionFunctionAbstract::getParameters indicates that the return value is "The parameters, as a ReflectionParameter object.". Of course, since a ReflectionParameter object is just reflecting one single parameter, it cannot return all of them as a single of those objects. Testing reveals that ReflectionFunctionAbstract::getParameters returns an _array_ of ReflectionParameter objects (more or less as expected). I tested this on php 5.2.9, but whether or not this behavior has changed in newer versions shouldn't matter as the documentation would still be incorrect. Reproduce code: --------------- class Test { public function AFunction($x, $y, $z) { $this->AnotherFunction($z, $x, $y); } } $r = new ReflectionMethod('Test', 'Afunction'); $p = $r->getParameters(); var_dump($p); Actual result: -------------- array(3) { [0]=> &object(ReflectionParameter)#2 (1) { ["name"]=> string(1) "x" } [1]=> &object(ReflectionParameter)#3 (1) { ["name"]=> string(1) "y" } [2]=> &object(ReflectionParameter)#4 (1) { ["name"]=> string(1) "z" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49631&edit=1

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