Suppose that two interfaces clash:
interface Alpha
{
function foo();
}
interface Beta
{
function foo();
}
Currently you can not have a class implement both of them.
I suggest the following syntax to solve this:
class Omega
{
implements interface Alpha
{
public function foo()
{
echo "Alpha::foo()<br>";
}
}
implements interface Beta
{
public function foo()
{
echo "Beta::foo()<br>";
}
}
}
How should PHP know which interface to use? The most obvious and probable case is that if an interface is specified for a parameter of a function, then that interface should be used:
function bar(Beta $beta)
{
$beta->foo(); // prints "Beta::foo()"
}
bar(new Omega());
Here's my suggestion of how to more directly specify which of the two methods to be used:
$omega->Alpha::foo(); // prints "Alpha::foo()"