3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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"; }
based on oPKZj
Output for 5.4.34 - 5.4.35
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/vDMNG on line 2
Process exited with code 255.
Output for 5.4.0 - 5.4.32
<?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"; }