Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55487 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15060 invoked from network); 17 Sep 2011 18:17:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Sep 2011 18:17:10 -0000 Authentication-Results: pb1.pair.com header.from=h.reindl@thelounge.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=h.reindl@thelounge.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain thelounge.net designates 91.118.73.15 as permitted sender) X-PHP-List-Original-Sender: h.reindl@thelounge.net X-Host-Fingerprint: 91.118.73.15 mail.thelounge.net Windows 98 (1) Received: from [91.118.73.15] ([91.118.73.15:54930] helo=mail.thelounge.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/D6-05466-324E47E4 for ; Sat, 17 Sep 2011 14:17:08 -0400 Received: from srv-rhsoft.rhsoft.net (openvpn-241.thelounge.net [10.0.0.241]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.thelounge.net (Postfix) with ESMTPSA id 2B4AA99 for ; Sat, 17 Sep 2011 20:17:05 +0200 (CEST) Message-ID: <4E74E420.3040705@thelounge.net> Date: Sat, 17 Sep 2011 20:17:04 +0200 Organization: the lounge interactive design User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2 MIME-Version: 1.0 To: internals@lists.php.net References: <4E74E22F.1070203@sugarcrm.com> In-Reply-To: <4E74E22F.1070203@sugarcrm.com> X-Enigmail-Version: 1.3.1 OpenPGP: id=7F780279; url=http://arrakis.thelounge.net/gpg/h.reindl_thelounge.net.pub.txt Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig211DF04C7FD1EBFD5F7C1030" Subject: Re: [PHP-DEV] __constructor parameter limitations. From: h.reindl@thelounge.net (Reindl Harald) --------------enig211DF04C7FD1EBFD5F7C1030 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am 17.09.2011 20:08, schrieb Stas Malyshev: > Hi! >=20 >> On Sat, Sep 17, 2011 at 17:08, Laruence wrote: >>>> class A { public function init($a, $b) { } } >>>> class B extends A { public function init($a) { } } >>>> >>>> =3D> PHP Strict Standards: Declaration of B::init() should be comp= atible >>> with >>>> that of A::init() >>> do you know any reason for this? >>> >> >> The reason for this is simply that B must act like A since every B obj= ect is >> also an object of A. >=20 > This is not a real reason, it's just repeating it. All B is saying in f= act "I'm going to ignore everything but the > first parameter", and there's no real reason not to allow it to do that= =2E There's no "act" that makes B incompatible > with A here, this warning is completely useless in this case i agree practical sample: class a { public function whatever($param, $no_cache=3D0) { } } class b extends a { public function whatever($param) { } } think about $no_cache is a new param of a library class with a default va= lue currently you have to "fix" all classes which are extend this class every= where as long you are using E_STRICT which we are using on all production machi= nes in combination with display_errors off and a global error-log for all hos= ts to make sure we are dealing with really clean code the same if b has an additonal parameter as long a has lesser params this is technical OK and compatible --------------enig211DF04C7FD1EBFD5F7C1030 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk505CAACgkQhmBjz394AnmPyACdE5PO+b1sndFWlatlwixjpsfs ycIAoJ0wGgNL6gb4gbdtChCd9XTpbj/M =5jI8 -----END PGP SIGNATURE----- --------------enig211DF04C7FD1EBFD5F7C1030--