Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55537 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55680 invoked from network); 19 Sep 2011 09:59:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2011 09:59:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.170 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.161.170 mail-gx0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:61147] helo=mail-gx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 49/6C-14600-962177E4 for ; Mon, 19 Sep 2011 05:59:09 -0400 Received: by gxk10 with SMTP id 10so1414813gxk.29 for ; Mon, 19 Sep 2011 02:58:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=aDXHzXHkHXolP6rB80/1jjM0N0bv75hUro6thCum5Nw=; b=H2+RPIODojaQXhmXAE64yyif1+s7dTQnPnALbm63hFncZBI8icGt73BOHqP+xeL9kA cXiRb+w0usDE3ysA4L5+P94wMOn2ffesScZqCfPkZHbiGP7aDMCsYl0AmMBPivAkJ7+e +v+FUiL3bywkbJraZsnUTU29/6XGe6m6YeI5k= MIME-Version: 1.0 Received: by 10.236.139.138 with SMTP id c10mr12483992yhj.62.1316426337680; Mon, 19 Sep 2011 02:58:57 -0700 (PDT) Received: by 10.147.41.10 with HTTP; Mon, 19 Sep 2011 02:58:57 -0700 (PDT) In-Reply-To: References: <4E74E5A0.2030006@sugarcrm.com> <4E76320F.6010904@sugarcrm.com> <4E764137.9080507@sugarcrm.com> <4E7685DE.6010805@sugarcrm.com> <4E768C86.3030307@sugarcrm.com> <4E769418.6040200@sugarcrm.com> <4E770163.2090001@sugarcrm.com> <4E770770.60809@sugarcrm.com> Date: Mon, 19 Sep 2011 11:58:57 +0200 Message-ID: To: Etienne Kneuss Cc: Stas Malyshev , PHP internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] __constructor parameter limitations. From: pierre.php@gmail.com (Pierre Joye) On Mon, Sep 19, 2011 at 11:56 AM, Etienne Kneuss 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