3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface FooInterface { public function bar(): FooInterface; } class Foo implements FooInterface { public function bar(): static { return $this; } } class Qux extends Foo { public function bar(): FooInterface { return $this; } }
Output for 8.1.32, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.14
Fatal error: Declaration of Qux::bar(): FooInterface must be compatible with Foo::bar(): static in /in/J04NA on line 19
Process exited with code 255.

preferences:
73.46 ms | 406 KiB | 5 Q