views:

20

answers:

1

What are the consequences of implementing the same interface through two different routes in PHP, are there any?

What I mean, is something like this:

interface baseInterface {}

abstract class baseClass implements baseInterface { }

interface myInterface extends baseInterface {}

class myClass extends baseClass implements myInterface {}

In this case myClass implements baseInterface from two different parents - myInterface and baseClass. Are there any consequences to this? My instinct is that PHP should handle this fine, but I just want to make sure. What exactly does PHP do in this case? Does it just check to see that the necessary functions are implemented for the interface each time it discovers it and call it a day or does it do something more?

+2  A: 

That will all work fine. You'll still have to keep them all straight in your head and documentation though :)

In other words, there are no technical concerns.

Scott Saunders
I guess I should specify, I'm assuming PHP 5+, as PHP4 had very different OO.
Scott Saunders
Assumption is correct.
Daniel Bingham