3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface IX {} class X implements IX {} class Y {} function foo(IX $x) {} $rf = new \ReflectionFunction('foo'); $rp = $rf->getParameters()[0]; $x = new X; var_dump($rp->getType(), $rp->getClass());
based on ijRiZ
Output for 7.1.0 - 7.2.0
object(ReflectionNamedType)#4 (0) { } object(ReflectionClass)#5 (1) { ["name"]=> string(2) "IX" }
Output for 7.0.0 - 7.0.20
object(ReflectionType)#4 (0) { } object(ReflectionClass)#5 (1) { ["name"]=> string(2) "IX" }
Output for 5.4.11 - 5.6.28
Fatal error: Call to undefined method ReflectionParameter::getType() in /in/JIVPF on line 13
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/JIVPF on line 10
Process exited with code 255.