Interfaces Constants Conflicts¶
<?php
interface A {
const FOO = 10;
}
interface b {
const FOO = 10;
}
class test implements A, B {}
PHP reports duplicate constant definitions in different interfaces.
This is very unusual occurrence, reported at linting time. It may also lead to quite a set back when one has to untangle these definitions.
So, shall we always give unique names across interfaces? Or just avoid multiple interfaces with constants on the same class?
There is no ‘use’ expression to solve the conflict.
Also, multiple same methods in different interface are OK.
See Also¶
PHP Error Messages¶
PHP Features¶
Last updated: 14 July 2026