3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace Wl\A; class B { public function get() { return "BBBBB"; } } $b = new B(); $funct = function (B $b) { print_r($b::get()); }; $closure = &$funct; $reflection = new \ReflectionFunction($closure); $arguments = $reflection->getParameters(); echo "ARGS:\n"; var_dump($arguments); try { $funct(""); } catch (\Exception $e) { echo "catched"; } catch (\TypeError $e) { echo "subidubi"; }
based on 0phML
Output for 7.0.0 - 7.2.0
ARGS: array(1) { [0]=> object(ReflectionParameter)#4 (1) { ["name"]=> string(1) "b" } } subidubi
Output for 5.3.18 - 5.6.28
ARGS: array(1) { [0]=> &object(ReflectionParameter)#4 (1) { ["name"]=> string(1) "b" } } Catchable fatal error: Argument 1 passed to Wl\A\{closure}() must be an instance of Wl\A\B, string given, called in /in/DV3QV on line 22 and defined in /in/DV3QV on line 12
Process exited with code 255.