Enum Are Not Linted¶
<?php
enum E {
case A = 'z';
case B = 'z';
}
It is possible to give two identical values to different enumeration cases, but not to execute it.
In PHP 8.1, duplicate case values generated a compilation error.
Since PHP 8.2, it is now waiting for the execution stage and the first usage of the enumeration, to raise a fatal error.
See Also¶
PHP Error Messages¶
PHP Features¶
Last updated: 14 July 2026