Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55540 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60631 invoked from network); 19 Sep 2011 10:16:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2011 10:16:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:48994] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C0/7D-14600-E76177E4 for ; Mon, 19 Sep 2011 06:16:31 -0400 Received: by bkar4 with SMTP id r4so5137349bka.29 for ; Mon, 19 Sep 2011 03:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=vL+7MJVjuoqdQlwBNWNN3mACzcXPV8JfjWxuLC/L1Ng=; b=N9Yf/L5QY9O5ekw59IwqWBzQFvgCcTh8t7A38pkhxf2Afo9WQvpX6g4Og+mXz5HAh5 49zGXqJJfi9JsvMzRT7TtdTaGkyaTAEjLhheFUMRFzdXWQaoTY5uoaV5jmYiybLC69n3 +UjQXToh8VLNXsdyOXGxj3M+DUVRhbcn2+xIo= MIME-Version: 1.0 Received: by 10.204.139.6 with SMTP id c6mr1386738bku.391.1316427386335; Mon, 19 Sep 2011 03:16:26 -0700 (PDT) Sender: ekneuss@gmail.com Received: by 10.204.59.68 with HTTP; Mon, 19 Sep 2011 03:16:26 -0700 (PDT) In-Reply-To: <4E7714EF.1060705@mageekbox.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> <4E7714EF.1060705@mageekbox.net> Date: Mon, 19 Sep 2011 12:16:26 +0200 X-Google-Sender-Auth: WGAFmr0y_i5WgMuCGSHnOtii-qU Message-ID: To: frederic.hardy@mageekbox.net Cc: Stas Malyshev , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=0015174c1014bc321104ad48a294 Subject: Re: [PHP-DEV] __constructor parameter limitations. From: colder@php.net (Etienne Kneuss) --0015174c1014bc321104ad48a294 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, 2011/9/19 Fr=C3=A9d=C3=A9ric Hardy > Hi ! > > >> You misunderstand what LSP means. It does not mean "overriding methods >> should have same signatures", it means "overriding methods should accept= any >> data that base method accepts". It never says it can not accept any othe= r >> 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() { ... } } > Sure you can. With function A3::f() you can both call $a3->f() and $a3->f(any $a that would work with A), any usage of A3 as a A will work jus= t fine, and this is the criteria. > > I'm agree that it's valid from PHP point of view because the language doe= s > not handle the argument in $a3->f(uniqid()), but it's totaly invalid from > OOP point of view. > > So if it's invalid for "normal" method, it's more invalid for abstract > 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 > > -- > =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=C3=A9d=C3=A9ric Hardy : Architecte d'application/Admin. syst=C3=A8me/E= rgonome > 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 > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Etienne Kneuss http://www.colder.ch --0015174c1014bc321104ad48a294--