Enum backing type must be int or string

Description

Backed enumeration have a name and a value for each case. The type of that value is specified next to the enumeration name, and can only by string or int. All other values are forbidden.

Example

<?php

enum E: A {
    case B;
}

?>

Literal Examples

  • Enum backing type must be int or string, A given

Solutions

  • Remove the type on the enumeration and its cases.

  • Use one of the valid types with the enumeration.