Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55539 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58987 invoked from network); 19 Sep 2011 10:09:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2011 10:09:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=frederic.hardy@mageekbox.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=frederic.hardy@mageekbox.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mageekbox.net from 217.70.183.195 cause and error) X-PHP-List-Original-Sender: frederic.hardy@mageekbox.net X-Host-Fingerprint: 217.70.183.195 relay3-d.mail.gandi.net Linux 2.6 Received: from [217.70.183.195] ([217.70.183.195:55223] helo=relay3-d.mail.gandi.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B7/1D-14600-3F4177E4 for ; Mon, 19 Sep 2011 06:09:55 -0400 X-Originating-IP: 217.70.178.130 Received: from mfilter1-d.gandi.net (mfilter1-d.gandi.net [217.70.178.130]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 98BB4A8096; Mon, 19 Sep 2011 12:09:52 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter1-d.gandi.net Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by mfilter1-d.gandi.net (mfilter1-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id dJ3KOE43ymOC; Mon, 19 Sep 2011 12:09:51 +0200 (CEST) X-Originating-IP: 92.103.14.114 Received: from [10.0.1.60] (unknown [92.103.14.114]) (Authenticated sender: frederic.hardy@mageekbox.net) by relay3-d.mail.gandi.net (Postfix) with ESMTPA id 0A595A8092; Mon, 19 Sep 2011 12:09:50 +0200 (CEST) Message-ID: <4E7714EF.1060705@mageekbox.net> Date: Mon, 19 Sep 2011 12:09:51 +0200 Reply-To: frederic.hardy@mageekbox.net User-Agent: Thunderbird 2.0.0.24 (X11/20101027) MIME-Version: 1.0 To: Stas Malyshev CC: "internals@lists.php.net" 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> <4E76CD67.2020700@thelounge.net> <4E7705F5.9080606@mageekbox.net> <4E77082B.3000503@sugarcrm.com> In-Reply-To: <4E77082B.3000503@sugarcrm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] __constructor parameter limitations. From: frederic.hardy@mageekbox.net (=?ISO-8859-1?Q?Fr=E9d=E9ric_Hardy?=) Hi ! > > You misunderstand what LSP means. It does not mean "overriding methods=20 > should have same signatures", it means "overriding methods should=20 > accept any data that base method accepts". It never says it can not=20 > accept any other data. Idem. So you can have : class A { public function f($a) { ... } } class A1 extends A { public function f($a =3D null) { ... } } class A2 extends A { public function f($a, $b =3D null) { ... } } BUT You can't have : class A3 extends A { public function f() { ... } } I'm agree that it's valid from PHP point of view because the language=20 does not handle the argument in $a3->f(uniqid()), but it's totaly=20 invalid from OOP point of view. So if it's invalid for "normal" method, it's more invalid for abstract=20 method, even if abstract method is constructor. Abstract method define a MANDATORY interface. So you can have : abstract class A { public abstract function f($a); } class A1 extends A { public function f($a =3D null) { ... } } class A2 extends A { public function f($a, $b =3D null) { ... } } BUT You can't have : class A3 extends A { public function f() { ... } } And the use of func_get_args() is not incompatible with that : class A4 extends A { public function ($a) { $variadicArgs =3D array_slice(func_get_args(), 1); } } Best regard, Fred --=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Fr=E9d=E9ric Hardy : Architecte d'application/Admin. syst=E8me/Ergonome CV : http://blog.mageekbox.net/public/cv.frederic.hardy.pdf Blog : http://blog.mageekbox.net Twitter : http://twitter.com/mageekguy =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D