3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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 "\n"; 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()); }
based on rFNs7
Output for 5.4.34 - 5.4.35
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/jMmdL 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, 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 "\n"; 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()); }