diff --git a/hphp/system/classes/reflection.php b/hphp/system/classes/reflection.php index b53e2ab22..2f923b453 100644 --- a/hphp/system/classes/reflection.php +++ b/hphp/system/classes/reflection.php @@ -542,7 +542,7 @@ class ReflectionFunctionAbstract { return $count; } - public function getReturnTypehintText() { + public function getReturnTypeText() { if (isset($this->info['return_type'])) { return $this->info['return_type']; } diff --git a/hphp/test/slow/reflection_classes/1363.php b/hphp/test/slow/reflection_classes/1363.php index 32a6597a9..5b75e6e43 100644 --- a/hphp/test/slow/reflection_classes/1363.php +++ b/hphp/test/slow/reflection_classes/1363.php @@ -1,2 +1,2 @@ $z): Vector { return $z; } $rf = new ReflectionFunction('foo'); var_dump($rf->getReturnTypehintText()); class C { function goo(): int { return 0; } } $rc = new ReflectionClass('C'); $rm = $rc->getMethod('goo'); var_dump($rm->getReturnTypehintText()); class C1 extends C { function goo() { return 0; } } $rc = new ReflectionClass('C1'); $rm = $rc->getMethod('goo'); var_dump($rm->getReturnTypehintText()); class C2 extends C1 { function goo(): string { return '0'; } } $rc = new ReflectionClass('C2'); $rm = $rc->getMethod('goo'); var_dump($rm->getReturnTypehintText()); interface I { function m(): string; } $rc = new ReflectionClass('I'); $rm = $rc->getMethod('m'); var_dump($rm->getReturnTypehintText()); interface I1 { function m(): T; } $rc = new ReflectionClass('I1'); $rm = $rc->getMethod('m'); var_dump($rm->getReturnTypehintText()); trait T { function t(): C { return new C(); } } class UseT { use T; } $rc = new ReflectionClass('UseT'); $rm = $rc->getMethod('t'); var_dump($rm->getReturnTypehintText()); \ No newline at end of file +function foo(Vector $z): Vector { return $z; } $rf = new ReflectionFunction('foo'); var_dump($rf->getReturnTypeText()); class C { function goo(): int { return 0; } } $rc = new ReflectionClass('C'); $rm = $rc->getMethod('goo'); var_dump($rm->getReturnTypeText()); class C1 extends C { function goo() { return 0; } } $rc = new ReflectionClass('C1'); $rm = $rc->getMethod('goo'); var_dump($rm->getReturnTypeText()); class C2 extends C1 { function goo(): string { return '0'; } } $rc = new ReflectionClass('C2'); $rm = $rc->getMethod('goo'); var_dump($rm->getReturnTypeText()); interface I { function m(): string; } $rc = new ReflectionClass('I'); $rm = $rc->getMethod('m'); var_dump($rm->getReturnTypeText()); interface I1 { function m(): T; } $rc = new ReflectionClass('I1'); $rm = $rc->getMethod('m'); var_dump($rm->getReturnTypeText()); trait T { function t(): C { return new C(); } } class UseT { use T; } $rc = new ReflectionClass('UseT'); $rm = $rc->getMethod('t'); var_dump($rm->getReturnTypeText()); diff --git a/hphp/test/slow/reflection_classes/1366.php b/hphp/test/slow/reflection_classes/1366.php index a6921f87c..3d8b1ccb5 100644 --- a/hphp/test/slow/reflection_classes/1366.php +++ b/hphp/test/slow/reflection_classes/1366.php @@ -4,7 +4,7 @@ function printFunc($rf) { foreach($rps as $rp) { var_dump($rp->getTypeText()); } - var_dump($rf->getReturnTypehintText()); + var_dump($rf->getReturnTypeText()); } function printClass($rc) { $rms = $rc->getMethods();