Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55483 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96883 invoked from network); 17 Sep 2011 15:21:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Sep 2011 15:21:23 -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:59110] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 70/34-05466-2FAB47E4 for ; Sat, 17 Sep 2011 11:21:22 -0400 Received: by bkar4 with SMTP id r4so4200678bka.29 for ; Sat, 17 Sep 2011 08:21:18 -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=xyh0r7vWv1w/SBahz03AswbAVG7rCurU15YTAWooWWU=; b=qvH3BF+VFhMybUmGsdjLrSizf/2WZpiR3Z84OUF3yP7+fWhhp0M0cFaAUkn4uSJTZD FGdSDZZID5+N96NbA3CjxEosp4DjbbCXxfJITMR5tJKzjI2mO2PIi0BpRd8Zffhpmg3g Ha9DgMDMMfgyVXXnTeFMIglbA7z4z7Za5+LK4= MIME-Version: 1.0 Received: by 10.204.133.156 with SMTP id f28mr398639bkt.79.1316272878733; Sat, 17 Sep 2011 08:21:18 -0700 (PDT) Sender: ekneuss@gmail.com Received: by 10.204.59.68 with HTTP; Sat, 17 Sep 2011 08:21:18 -0700 (PDT) In-Reply-To: References: Date: Sat, 17 Sep 2011 17:21:18 +0200 X-Google-Sender-Auth: mqxEjSxbs0edIsxpep3OoRteOP8 Message-ID: To: Laruence Cc: Ferenc Kovacs , Nikita Popov , RQuadling@gmail.com, PHP internals Content-Type: multipart/alternative; boundary=0015174485ea5d48ba04ad24a902 Subject: Re: [PHP-DEV] __constructor parameter limitations. From: colder@php.net (Etienne Kneuss) --0015174485ea5d48ba04ad24a902 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sat, Sep 17, 2011 at 17:15, Laruence wrote: > Hi: > this is really a big bc break...(fatal error) > is there any reason for us to really change this? In Yaf, there > are a lot of Abstract classes, the subclass only need declared there > argument when they really need it. > Well, that is wrong. if you declare an abstract method with a set of arguments, classes implementing that method should be compatible with that set of arguments. > > and I really not think this change is good one, the Intenal class > can not be saw by userland(sure, doc, reflection), so they only get > the FATAL ERROR(you are wrong) but will never be told how should they > to do.. Given that we have been quite flexible with this in the past, I don't believe a E_FATAL is warranted here, might be better suited as a E_STRICT, as there is no apparent reason why this would prevent the engine to continue. > thanks > > 2011/9/17 Ferenc Kovacs : > > maybe Richard referring to https://bugs.php.net/bug.php?id=3D55085 ? > > but those change only affects the abstract classes. > > > > Tyrael > > > > On Sat, Sep 17, 2011 at 3:43 PM, Nikita Popov > wrote: > >> Hi Richard! > >> > >> Which change are you talking about? I just tried doing: > >> >> class A { public function __construct($a) { } } > >> class B extends A { public function __construct($a, $b) { } } > >> And it worked on 5.4 Beta 1 without errors. > >> > >> Nikita > >> > >> On Sat, Sep 17, 2011 at 3:27 PM, Richard Quadling > wrote: > >>> Hi. > >>> > >>> With the recent BC with regard the locking of the constructor's > >>> signature for subclasses, what is the expected mechanism for allowing > >>> a subclass to have additional parameters? > >>> > >>> You can always supply them and use func_get_args() / func_num_args() = / > >>> etc. to read them. > >>> > >>> It would seem that the limitation restricts the capabilities. I'm not > >>> a purist. Software development is a compromise between purity and > >>> getting the job done in an efficient and understandable manner. > >>> > >>> By allowing undocumented parameters to the constructor (due to the > >>> enforced signature), this would seem to break things on a different > >>> front (I can't docblock non defined parameters for examples). > >> > >> -- > >> PHP Internals - PHP Runtime Development Mailing List > >> To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > > > > > > > > -- > > Ferenc Kov=C3=A1cs > > @Tyr43l - http://tyrael.hu > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > Laruence Xinchen Hui > http://www.laruence.com/ > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Etienne Kneuss http://www.colder.ch --0015174485ea5d48ba04ad24a902--