3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A {} class B {} class C {} class D {} class Z { public function __construct( protected A $a, protected C|B $c, protected D|C $d, ) { if ($this->c instanceof B) { trigger_error('A, B, C, D is deprecated, pass A, C, D instead', E_USER_DEPRECATED); $this->c = $this->d; $this->d = func_get_arg(3); } var_dump($this->a); var_dump($this->c); var_dump($this->d); } } new Z(new A(), new B(), new C(), new D()); new Z(new A(), new C(), new D());

preferences:
28.84 ms | 406 KiB | 5 Q