Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55481 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94788 invoked from network); 17 Sep 2011 15:17:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Sep 2011 15:17:34 -0000 Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; 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:54920] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7A/B3-05466-C0AB47E4 for ; Sat, 17 Sep 2011 11:17:33 -0400 Received: by bkar4 with SMTP id r4so4198939bka.29 for ; Sat, 17 Sep 2011 08:17:29 -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=f//cjsyCtJoekiMDIn7Bh4iI0PLd0dLrfIJ554LHmuA=; b=FHcZO9sqlMsIUF5I/j1itq0yfayWNuqF8I/Fe6ufhR+srXywExYj+d4mMTgScN4OD6 LEkObj52mO/nwerq886LnkHgORNLyV2Ue9ffoBn8IKowR59fr4bZx+WdelJUoUg3g2k6 ecGaa8Yx/RUVcvKPIuc66EOCK2Rl0AzUDAFmw= MIME-Version: 1.0 Received: by 10.204.7.89 with SMTP id c25mr444463bkc.183.1316272649834; Sat, 17 Sep 2011 08:17:29 -0700 (PDT) Sender: ekneuss@gmail.com Received: by 10.204.59.68 with HTTP; Sat, 17 Sep 2011 08:17:29 -0700 (PDT) In-Reply-To: References: Date: Sat, 17 Sep 2011 17:17:29 +0200 X-Google-Sender-Auth: nMiOM1u1srxdrFpkXcbyY1PUyY8 Message-ID: To: Laruence Cc: devis@lucato.it, internals@lists.php.net, RQuadling@gmail.com, Nikita Popov Content-Type: multipart/alternative; boundary=00151743f778b88f5804ad249be3 Subject: Re: [PHP-DEV] __constructor parameter limitations. From: colder@php.net (Etienne Kneuss) --00151743f778b88f5804ad249be3 Content-Type: text/plain; charset=UTF-8 On Sat, Sep 17, 2011 at 17:08, Laruence wrote: > 2011/9/17 : > > Hi, > > > > I think Richards intended other methods often used in combination with > > __construct: > > > > class A { public function init($a, $b) { } } > > class B extends A { public function init($a) { } } > > > > => PHP Strict Standards: Declaration of B::init() should be compatible > 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 object is also an object of A. > > > > The example with __construct() is valid (at least in 5.3). > > > > > > Devis > > > > > > On 17 September 2011 14:43, 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 > >> > >> > > > > > > -- > Laruence Xinchen Hui > http://www.laruence.com/ > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Etienne Kneuss http://www.colder.ch --00151743f778b88f5804ad249be3--