Duplicate value in enum %s for cases %s and %s

Description

When an enumeration is backed, either string or int, the values used in the cases must all be distinct. There cannot be any duplicate value. This problem is only reported at execution time, when one of the cases is used.

Example

<?php

enum E: int {
    case A = 1;
    case B = 1;
}

E::A;

?>

Literal Examples

  • Duplicate value in enum E for cases A and B

Solutions

  • Make sure all the cases are distinct.