Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55479 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92086 invoked from network); 17 Sep 2011 15:08:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Sep 2011 15:08:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.45 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.212.45 mail-vw0-f45.google.com Received: from [209.85.212.45] ([209.85.212.45:35127] helo=mail-vw0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9D/13-05466-CF7B47E4 for ; Sat, 17 Sep 2011 11:08:44 -0400 Received: by vws17 with SMTP id 17so7859066vws.32 for ; Sat, 17 Sep 2011 08:08:42 -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:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=3e2abUyO7OF7I0+oFqs1wdkqZBc/iTWyFErpzZVIiv8=; b=Vc5gc+Vn6o4h+6c6exhhsLuOpCkzOhkymh3ol78sq4S4a0hS0fs81JQbSQuDiYM18/ MvhfsU6oQCojhLxQdPK6eUqncj79vXW/lf0Zw0/+AIpwEDFD1qwr0LVht1RjfBvj4PZ0 ZwgtAlZhLwx7NIvtQLgdpoMk/3WESvYCh2fWQ= Received: by 10.52.35.112 with SMTP id g16mr545725vdj.24.1316272122125; Sat, 17 Sep 2011 08:08:42 -0700 (PDT) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.94.142 with HTTP; Sat, 17 Sep 2011 08:08:22 -0700 (PDT) In-Reply-To: References: Date: Sat, 17 Sep 2011 23:08:22 +0800 X-Google-Sender-Auth: _EwqfGtNzq8okrP-fBCdu4OnzQs Message-ID: To: devis@lucato.it Cc: internals@lists.php.net, RQuadling@gmail.com, Nikita Popov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] __constructor parameter limitations. From: laruence@php.net (Laruence) 2011/9/17 : > Hi, > > I think Richards intended other methods often used in combination with > __construct: > > class A =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 { public function init($a, $b)= { } } > class B extends A { public function init($a) { } } > > =3D> PHP Strict Standards: =C2=A0Declaration of B::init() should be compa= tible with > that of A::init() do you know any reason for this? > > The example with __construct() is valid (at least in 5.3). > > > Devis > > > On 17 September 2011 14:43, Nikita Popov wrot= e: > >> Hi Richard! >> >> Which change are you talking about? I just tried doing: >> =C2=A0 =C2=A0> =C2=A0 =C2=A0class A =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 { public functio= n __construct($a) =C2=A0 =C2=A0 { } } >> =C2=A0 =C2=A0class 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 >> >> > --=20 Laruence =C2=A0Xinchen Hui http://www.laruence.com/