3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public function __construct(Bar $test) { } } class Bar { public function __construct() { } } $reflection = new ReflectionClass('Foo'); $params = $reflection->getConstructor()->getParameters(); foreach ($params AS $param) { var_dump($param); }
based on vCCA8
Output for 5.6.30, 7.0.28 - 7.3.0beta1
object(ReflectionParameter)#3 (1) { ["name"]=> string(4) "test" }
Output for hhvm-3.18.5 - 3.22.0
object(ReflectionParameter)#3 (3) { ["info"]=> array(10) { ["index"]=> int(0) ["name"]=> string(4) "test" ["type"]=> string(3) "Bar" ["type_hint"]=> string(3) "Bar" ["type_hint_builtin"]=> bool(false) ["function"]=> string(11) "__construct" ["class"]=> string(3) "Foo" ["type_hint_nullable"]=> bool(false) ["attributes"]=> array(0) { } ["is_optional"]=> bool(false) } ["name"]=> string(4) "test" ["paramTypeInfo"]=> array(3) { ["name"]=> string(3) "Bar" ["nullable"]=> bool(false) ["builtin"]=> bool(false) } }