3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait X{ function test(A $a){} function tryA(A $a){ $this->test($a); } } trait Y{ function test(B $b){} function tryB(B $b){ $this->test($b); } } class Test{ use X, Y{ X::test insteadof Y; } } class A{} class B{} $x = new Test; $x->tryA(new A); $x->tryB(new B);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: Test::test(): Argument #1 ($a) must be of type A, B given, called in /in/R8ZKl on line 15 and defined in /in/R8ZKl:4 Stack trace: #0 /in/R8ZKl(15): Test->test(Object(B)) #1 /in/R8ZKl(30): Test->tryB(Object(B)) #2 {main} thrown in /in/R8ZKl on line 4
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
57.07 ms | 401 KiB | 8 Q