diff --git a/hphp/system/classes/reflection.php b/hphp/system/classes/reflection.php index 515afbd2c..ed36d5985 100644 --- a/hphp/system/classes/reflection.php +++ b/hphp/system/classes/reflection.php @@ -36,11 +36,13 @@ class ReflectionException extends Exception { */ class ReflectionParameter implements Reflector { public $info; + public $name; public function __construct($func, $param) { if ($func && $param) { $params = $func->getParameters(); $this->info = $params[$param]->info; + $this->name = $this->info['name']; } } @@ -497,6 +499,7 @@ class ReflectionFunctionAbstract { foreach ($this->info['params'] as $name => $info) { $param = new ReflectionParameter(null, null); $param->info = $info; + $param->name = $info['name']; $ret[] = $param; } return $ret; diff --git a/hphp/test/quick/reflection.php.expectf b/hphp/test/quick/reflection.php.expectf index bf30386ab..17644206b 100644 --- a/hphp/test/quick/reflection.php.expectf +++ b/hphp/test/quick/reflection.php.expectf @@ -25,7 +25,7 @@ int(2) --- getParameters("f") --- array(4) { [0]=> - object(ReflectionParameter)#5 (1) { + object(ReflectionParameter)#5 (2) { ["info"]=> array(7) { ["index"]=> @@ -44,9 +44,11 @@ array(4) { array(0) { } } + ["name"]=> + string(1) "a" } [1]=> - object(ReflectionParameter)#6 (1) { + object(ReflectionParameter)#6 (2) { ["info"]=> array(8) { ["index"]=> @@ -67,9 +69,11 @@ array(4) { array(0) { } } + ["name"]=> + string(1) "b" } [2]=> - object(ReflectionParameter)#7 (1) { + object(ReflectionParameter)#7 (2) { ["info"]=> array(9) { ["index"]=> @@ -92,9 +96,11 @@ array(4) { array(0) { } } + ["name"]=> + string(1) "c" } [3]=> - object(ReflectionParameter)#8 (1) { + object(ReflectionParameter)#8 (2) { ["info"]=> array(9) { ["index"]=> @@ -124,6 +130,8 @@ array(4) { array(0) { } } + ["name"]=> + string(1) "d" } } diff --git a/hphp/test/quick/reflection2.php.expectf b/hphp/test/quick/reflection2.php.expectf index 1582ef813..26f15be09 100644 --- a/hphp/test/quick/reflection2.php.expectf +++ b/hphp/test/quick/reflection2.php.expectf @@ -246,7 +246,7 @@ array(6) { } } } -object(ReflectionParameter)#9 (1) { +object(ReflectionParameter)#9 (2) { ["info"]=> array(7) { ["index"]=> @@ -265,4 +265,6 @@ object(ReflectionParameter)#9 (1) { array(0) { } } + ["name"]=> + string(1) "c" }