<?hh
class X<T>{
public function m(T $a, int $b){}
}
function f(?int $one, @int $two, int $three) {}
echo "Testing getTypehintText() on f(): \n";
$r = new ReflectionFunction('f');
foreach ($r->getParameters() as $p) {
echo "Parameter $".$p->getName().": ";
var_dump($p->getTypehintText());
}
echo "Testing getTypehintText() on X::m(): \n";
$r = new ReflectionMethod('X::m');
foreach ($r->getParameters() as $p) {
echo "Parameter $".$p->getName().": ";
var_dump($p->getTypehintText());
}
<?hh
class X<T>{
public function m(T $a, int $b){}
}
function f(?int $one, @int $two, int $three) {}
echo "Testing getTypehintText() on f(): \n";
$r = new ReflectionFunction('f');
foreach ($r->getParameters() as $p) {
echo "Parameter $".$p->getName().": ";
var_dump($p->getTypehintText());
}
echo "Testing getTypehintText() on X::m(): \n";
$r = new ReflectionMethod('X::m');
foreach ($r->getParameters() as $p) {
echo "Parameter $".$p->getName().": ";
var_dump($p->getTypehintText());
}
Output for 8.0.13
Parse error: syntax error, unexpected token "class" in /in/rFNs7 on line 2
Process exited with code 255.
Output for 5.4.34 - 5.4.35, 7.3.32 - 7.3.33, 7.4.33
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/rFNs7 on line 2
Process exited with code 255.