Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37307 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36514 invoked from network); 29 Apr 2008 16:11:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Apr 2008 16:11:26 -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:57712] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/B8-26601-DA847184 for ; Tue, 29 Apr 2008 12:11:26 -0400 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 29 Apr 2008 19:12:17 +0300 Received: from [192.168.17.71] ([192.168.17.71]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 29 Apr 2008 09:12:13 -0700 Message-ID: <481748A6.9010801@zend.com> Date: Tue, 29 Apr 2008 09:11:18 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: Sam Barrow CC: internals@lists.php.net References: <1209476047.3257.2.camel@sbarrow-desktop> In-Reply-To: <1209476047.3257.2.camel@sbarrow-desktop> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 29 Apr 2008 16:12:14.0039 (UTC) FILETIME=[C96AF670:01C8AA13] Subject: Re: [PHP-DEV] Inheritance/compatibility behavior From: stas@zend.com (Stanislav Malyshev) Hi! Sam Barrow wrote: > I want to make two classes: > > abstract class a { > abstract public function go($a); > } > final class b extends a { > abstract public function go(array $a); > } LSP violation here: a accepts go("away") but b doesn't. > This will not work, I get an error that the two must be compatible. > Wouldn't it be a good idea to allow any type hint for a parameter that > does not specify a type hint? No, because of the LSP. Subtypes should not strengthen preconditions. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com