Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55510 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74679 invoked from network); 19 Sep 2011 00:43:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2011 00:43:01 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.170 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.213.170 mail-yx0-f170.google.com Received: from [209.85.213.170] ([209.85.213.170:45543] helo=mail-yx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/46-28880-410967E4 for ; Sun, 18 Sep 2011 20:43:00 -0400 Received: by yxi13 with SMTP id 13so4474355yxi.29 for ; Sun, 18 Sep 2011 17:42: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:content-transfer-encoding; bh=S1F/s9gbXCHI4Cp0fjSfydlk90VTH7sDiG/tcxr5mPQ=; b=WPMyypw+A4ql27qOYkOhGIQUPphDbtFyQqhB+FoMByNbSMPBeJ0gXP7kvfqIxp9NdV T7OPXi9z1D+aUp7WfhFwBHYs0IUqmBm/M3yb+UwoeJlUseqpAsIaaouKxxEtI8cgpVKS RkfoQWrcAAhD8x3AbXhx+AEB/vMdnZGdR/91Y= MIME-Version: 1.0 Received: by 10.146.192.28 with SMTP id p28mr1599981yaf.35.1316392977759; Sun, 18 Sep 2011 17:42:57 -0700 (PDT) Received: by 10.147.41.10 with HTTP; Sun, 18 Sep 2011 17:42:57 -0700 (PDT) In-Reply-To: <4E768C86.3030307@sugarcrm.com> References: <4E74E5A0.2030006@sugarcrm.com> <4E76320F.6010904@sugarcrm.com> <4E764137.9080507@sugarcrm.com> <4E7685DE.6010805@sugarcrm.com> <4E768C86.3030307@sugarcrm.com> Date: Mon, 19 Sep 2011 02:42:57 +0200 Message-ID: To: Stas Malyshev Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] __constructor parameter limitations. From: pierre.php@gmail.com (Pierre Joye) On Mon, Sep 19, 2011 at 2:27 AM, Stas Malyshev wro= te: > Hi! > > On 9/18/11 5:24 PM, Pierre Joye wrote: >> >> class foo{ >> =A0function __construct(){} >> } >> class bar extends foo{ >> =A0 function__construct($a, $b){} >> } > > Come on. This is not my example. My example was: > > class foo{ > =A0function __construct($a, $b){} > } > class bar extends foo{ > =A0function__construct(){} > } > > I would expect people at least read what I write before replying - is it = too > much? You never misread something right? Can you please cool? Such comments do not help, at all. Thanks. > I wrote "foo() is compatible with foo($a, $b)" not the other way > around and in case it wasn't clear I gave specific example. But this exact example works, only the similar case using abstract will fail, and it makes to fail here as an abstract method is only the declaration, the implementation being done in the child class (bar extends foo). This is the concept of 'abstract', see it like the declaration and implementation in C. The PHP documentation is also clear about that: "Methods defined as abstract simply declare the method's signature" For the record again here, the abstract example: abstract class foo{ abstract public function foo(Type1 $foo, Type2 $bar); } class bar extends foo{ public function foo() { } } Cheers, --=20 Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org