- Output for 8.1.0 - 8.1.7
- Output for 7.4.0 - 7.4.30, 8.0.1 - 8.0.20
- Fatal error: Declaration of Goldfish::getSound(): never must be compatible with Animal::getSound(): string in /in/ZRZZE on line 15
Process exited with code 255.
<?php
abstract class Animal{
abstract public function getSound(): string;
}
class Cat extends Animal{
public function getSound(): string{
return 'meow';
}
}
class Goldfish extends Animal{
public function getSound(): never {
throw new Exception('Goldfish makes no sound');
}
}