Cannot redefine class constant %s::%s
Description
PHP does not allow the same constant twice in the same class. The constant may be declared several times in different classes, including extending or extended ones, or in trait, as each case has conflict resolution mechanisms.
Example
<?php
class C {
const FOO = hello;
const FOO = hello again;
}
?>
Literal Examples
- Cannot redefine class constant C::FOO
Alternatives
- Rename one of the conflicting constants.
- Remove one of the conflicting constants.
Related error messages
Changed Behavior
This error may appear following an evolution in behavior, in previous versions. See