Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Class %s cannot extend enum %s

Description

Enum are final classes, and cannot be extended: neither by other enum, nor by a class.

Example

<?php

class X extends E {}

enum E {}

?>

Literal Examples

  • Class X cannot extend enum E

Alternatives

  • Add a class that compose the enum, and extends that class.
  • Remove the extension in the class.