%s %s cannot implement interface %s, extend Exception or Error instead¶
Description¶
Throwable
is a PHP native and reserved interface. It may be used for typing, such as with catch
or parameter typing, but cannot be used directly.
As the message suggest, the best is to extends an existing class that already implements Throwable
, such as Error
, Exception
or any of their children classes.
Several interfaces are reserved by PHP: UnitEnum
, BackedEnum
, Throwable
.
Example¶
<?php
class X implements Throwable {}
?>
Literal Examples¶
Class X cannot implement interface Throwable, extend Exception or Error instead
Solutions¶
Extends
Exception
class.Extends
Error
class.Extends any of the
Exception
orError
classes.