3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SomeParent { public function foo(): static { return $this; } } final class SomeChild extends SomeParent { public function foo(): SomeChild { return $this; } } var_dump((new SomeChild())->foo());
Output for 8.2.0 - 8.2.28, 8.3.0 - 8.3.22, 8.4.1 - 8.4.8
Fatal error: Declaration of SomeChild::foo(): SomeChild must be compatible with SomeParent::foo(): static in /in/fmclK on line 13
Process exited with code 255.

preferences:
152.67 ms | 998 KiB | 7 Q