Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55477 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85594 invoked from network); 17 Sep 2011 14:37:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Sep 2011 14:37:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=devis@oracolo.com; spf=fail; sender-id=fail Authentication-Results: pb1.pair.com header.from=devis@oracolo.com; sender-id=fail Received-SPF: fail (pb1.pair.com: domain oracolo.com does not designate 209.85.216.43 as permitted sender) X-PHP-List-Original-Sender: devis@oracolo.com X-Host-Fingerprint: 209.85.216.43 mail-qw0-f43.google.com Received: from [209.85.216.43] ([209.85.216.43:40858] helo=mail-qw0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E8/E1-05466-890B47E4 for ; Sat, 17 Sep 2011 10:37:13 -0400 Received: by qwm42 with SMTP id 42so6550606qwm.2 for ; Sat, 17 Sep 2011 07:37:10 -0700 (PDT) Received: by 10.229.40.199 with SMTP id l7mr463594qce.44.1316270229348; Sat, 17 Sep 2011 07:37:09 -0700 (PDT) MIME-Version: 1.0 Sender: devis@oracolo.com Received: by 10.229.216.133 with HTTP; Sat, 17 Sep 2011 07:36:29 -0700 (PDT) In-Reply-To: References: Date: Sat, 17 Sep 2011 15:36:29 +0100 X-Google-Sender-Auth: qpqnYSOsYO0EP5RjkoQBnhOCdv0 Message-ID: To: internals@lists.php.net Cc: RQuadling@gmail.com, Nikita Popov Content-Type: multipart/alternative; boundary=001636833b8a72e2c704ad240b12 Subject: Re: [PHP-DEV] __constructor parameter limitations. From: devis@lucato.it --001636833b8a72e2c704ad240b12 Content-Type: text/plain; charset=UTF-8 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() 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 > > --001636833b8a72e2c704ad240b12--