3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait A { public function x(): void { echo 'A'; } } trait B { public function x(): void { echo 'B'; } } class Foo { use A { x as private ax; } use B { x as private bx; } public function x(): void { $this->ax(); $this->bx(); } } (new Foo())->x();
Output for 8.1.32, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
Fatal error: An alias was defined for method x(), which exists in both A and B. Use A::x or B::x to resolve the ambiguity in /in/vE0YH on line 15
Process exited with code 255.

preferences:
70.51 ms | 406 KiB | 5 Q