3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait AbstractTrait { abstract public function selfReturner(): self; } trait ConcreteTrait { public function selfReturner(): Test { return $this; } } class Test { use AbstractTrait; use ConcreteTrait; }
based on HMCn8
Output for 8.0.0
Output for 7.4.0 - 7.4.13
Fatal error: Declaration of ConcreteTrait::selfReturner(): Test must be compatible with AbstractTrait::selfReturner(): AbstractTrait in /in/g8o3L on line 8
Process exited with code 255.
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.26
Fatal error: Declaration of ConcreteTrait::selfReturner(): Test must be compatible with AbstractTrait::selfReturner(): AbstractTrait in /in/g8o3L on line 13
Process exited with code 255.