extending interfaces - fringe behavior
| From: | Hans Lellelid | Date: | Mon, 16 Feb 2004 05:55:16 +0000 |
| Subject: | extending interfaces - fringe behavior | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-7866@lists.php.net to get a copy of this message | ||
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.
Thanks,
Hans