3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Model {} class PlayerModel extends Model {} abstract class Repository { abstract public function save(Model $model); } class PlayerRepository extends Repository { public function save(PlayerModel $model) { print get_class($model); } } $player = new PlayerModel(); $repository = new PlayerRepository(); $repository->save($player);
Output for 7.4.0 - 7.4.13, 8.0.0
Fatal error: Declaration of PlayerRepository::save(PlayerModel $model) must be compatible with Repository::save(Model $model) in /in/nikF1 on line 13
Process exited with code 255.
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.25
Fatal error: Declaration of PlayerRepository::save(PlayerModel $model) must be compatible with Repository::save(Model $model) in /in/nikF1 on line 16
Process exited with code 255.

preferences:
130.78 ms | 1445 KiB | 7 Q