Consider the following PHP interfaces:
interface Item {
// some methods here
}
interface SuperItem extends Item {
// some extra methods here, not define
As a workaround I'm using PHPDoc blocks in interfaces.
interface Collection {
/**
* @param Item $item
*/
public function add($item);
// more methods here
}
interface SuperCollection extends Collection {
/**
* @param SuperItem $item
*/
public function add($item);
// more methods here that "override" the Collection methods like "add()" does
}
This way, in case you are properly using interfaces, IDE should help you catch some errors. You can use similar technique to override return value types as well.