On Mon, Sep 19, 2011 at 11:56 AM, Etienne Kneuss <col...@php.net> wrote:
>> There is a precondition that the abstract method enforces in such >> prototypes, and it is: >> - I will require at least X arguments >> if a method implements this and defines the prototype with: >> - I will require at least Y arguments with Y < X >> The procondition of the subclass method is looser. And this is perfectly >> fine. >> You may debate whether it is "at least X" or not that the prototype >> defines, but that's exactly what it does and how PHP w.r.t. to function >> calls work, we have always allowed more arguments in the call than functions >> declares. > > Apparently you guys are speaking about the initial implementation of an > abstract method, while I was talking about overriding a method, which is not > the relly same. So the above doesn't really apply. > The initial implementation of an abstract method should match the signature, > while overriding a method should be able to loosen the precondition in many > ways (type hints change, less arguments, etc..), IMO. Exactly. Abstract is a different than interface or simple extended classes. That's something I totally fail to make clear in this lengthy thread. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php