I have a need in a current application to extend interfaces and possibly re-define (change signature) some of the inherited methods in the child interface.
e.g.
interface Foo { public function __construct(MyCls $var); public function myFunction(); }
interface Bar extends Foo { public function __construct(MyCls $var, $var2 = null); public function myOtherFunction(); }
class A implements Bar { public function __construct(MyCls $var, $var2 = null) { // ... } public function myFunction() { // ... } public function myOtherFunction() { // ... } }
This is not currently possible in PHP5b4, due to the (new?) "Can't inherit abstract function" errors generated by the engine. I.e. if I try to redefine __construct() I will get an error.
The need for this capability is probably not that mainstream, but it'd be very nice. Is there any chance of having support for this behavior? I don't know anything about the underlying mechanism for supporting interface extension, so I don't know if what I'm asking is trivial or not.
You're not supposed to change the signature when you're extending/implementing interfaces. I'll try to see if it's feasible to improve the checks so that they compare signatures in a smarter way (i.e., func($arg1, $arg2=null) is compatible with func($arg1), and currently it's not detected that way).
Zeev
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php