Re: extending interfaces - fringe behavior
| From: | Zeev Suraski | Date: | Mon, 16 Feb 2004 09:39:00 +0000 |
| Subject: | Re: extending interfaces - fringe behavior | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-7871@lists.php.net to get a copy of this message | ||
At 07:55 16/02/2004, Hans Lellelid wrote:
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 {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). Zeevpublic 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.