Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35865 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27154 invoked by uid 1010); 29 Feb 2008 17:45:03 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 27135 invoked from network); 29 Feb 2008 17:45:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Feb 2008 17:45:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:47420] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7D/01-14860-49448C74 for ; Fri, 29 Feb 2008 12:44:58 -0500 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 29 Feb 2008 19:45:03 +0200 Received: from [192.168.17.68] ([192.168.17.68]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 29 Feb 2008 09:44:58 -0800 Message-ID: <47C8448C.70901@zend.com> Date: Fri, 29 Feb 2008 09:44:44 -0800 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Christian Schneider CC: internals Mailing List References: <47C84070.2030708@cschneid.com> In-Reply-To: <47C84070.2030708@cschneid.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 29 Feb 2008 17:44:58.0349 (UTC) FILETIME=[CD3849D0:01C87AFA] Subject: Re: [PHP-DEV] OO Parameter Checking From: stas@zend.com (Stanislav Malyshev) Hi! > 1) The current checks are IMHO too strict regarding default values for > parameters: An inheriting class can add default values to a parameter > without breaking the protocol: > class A { function foo($x) { ... } } > class B extends A { function foo($x = 42) { ... } } > should be allowed. Only if there are fewer parameters in B::foo or if I think this makes sense. In fact, if B::foo() has less parameters it might be OK too, since B would just ignore extra parameters (and in fact it could do it anyway :) > 2) The current checks are IMHO too strict regarding static functions: > Static functions are not part of an instance's protocol (they can not be > passed around) and should be left out of the check the same way > constructors are ignored. The use case for this is a factory method: > class A { static function factory($size) { ... } } > class B extends A { static function factory($size, $color) { ... } } Not sure about this - might be some nasty surprises here if you substitute class B for class A. Anyway, why not call B's function factoryB or something? If you are only going to call it directly by name, there's no difference. It would be nice if you made separate patches for each feature. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com