<?hh
class X<T>{
public function m(T $a){}
}
function f(?int $one, @int $two, int $three) {}
echo "Testing getTypehintText() on f(): \n";
$r = new ReflectionFunction('f');
foreach ($r->getParameters() as $p) {
var_dump($p->getTypehintText());
echo "\n";
}
echo "Testing getTypehintText() on X::m(): \n";
$r = new ReflectionMethod('X::m');
foreach ($r->getParameters() as $p) {
var_dump($p->getTypehintText());
echo "\n";
}
<?hh
class X<T>{
public function m(T $a){}
}
function f(?int $one, @int $two, int $three) {}
echo "Testing getTypehintText() on f(): \n";
$r = new ReflectionFunction('f');
foreach ($r->getParameters() as $p) {
var_dump($p->getTypehintText());
echo "\n";
}
echo "Testing getTypehintText() on X::m(): \n";
$r = new ReflectionMethod('X::m');
foreach ($r->getParameters() as $p) {
var_dump($p->getTypehintText());
echo "\n";
}
Output for 8.0.13
Parse error: syntax error, unexpected token "class" in /in/vDMNG 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/vDMNG on line 2
Process exited with code 255.