Interface Implemented Too Low¶
<?php
interface i {
function foo($a);
}
class x {
function foo() {}
}
class y extends x implements i {
function foo($a = 1) { echo __METHOD__; }
}
An interface’s signatures applies only to the current class and its children. It means that the parent do not have to use the same signature.
Although, the parent and the child must use a compatible signature, independently from the interface. And, in the end, the child signature must be compatible with both the parent and the interface. Note how the parent and the interface methods are quite different, yet are compatible.
While it may be convenient to use the interface on a single child and not on its siblings, it might be less surprising to use the interface on the parent directly. Unless it does not have such a method.
See Also¶
Interface on a child [Try me]
PHP Features¶
Last updated: 16 July 2026