|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-10-02 20:46 UTC] svn@php.net
[2009-10-02 20:47 UTC] fa@php.net
[2020-02-07 06:10 UTC] phpdocbot@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 08 15:00:02 2026 UTC |
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" }