Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10587 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8231 invoked by uid 1010); 18 Jun 2004 14:41:07 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 8099 invoked from network); 18 Jun 2004 14:41:06 -0000 Received: from unknown (HELO sara.dreamhost.com) (66.33.193.59) by pb1.pair.com with SMTP; 18 Jun 2004 14:41:06 -0000 Received: from [192.168.0.152] (mail.appliedsec.com [69.17.65.231]) by sara.dreamhost.com (Postfix) with ESMTP id 02A8B9F111; Fri, 18 Jun 2004 07:41:06 -0700 (PDT) Message-ID: <40D2FF04.3010003@velum.net> Date: Fri, 18 Jun 2004 10:41:08 -0400 User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Marcus Boerger Cc: internals@lists.php.net References: <20040615112747.27402.qmail@pb1.pair.com> <40CEDECA.9040600@cschneid.com> <40D05892.6090804@memefeeder.com> <913185304.20040616211716@marcus-boerger.de> <40D19B3E.4030802@memefeeder.com> <4210590559.20040617205826@marcus-boerger.de> In-Reply-To: <4210590559.20040617205826@marcus-boerger.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: ClassHints and NULL From: hans@velum.net (Hans Lellelid) Hi, Marcus Boerger wrote: > Last but not least we know already that a lot of people like to > be able to handle both instanceof or null with typehints. But at > the moment we have no solution that can go into PHP 5.0. However > i am quite sure we will address this for 5.1. I'm glad this issue will be re-evaluated. I think the loss of null option is disappointing since it precludes optional params (which was really the only place I was using it), but I also understand the reasoning. Here is a slightly related example from my code which is preventing me from being able to use typehints at all -- the issue is more than just allowing null, clearly: abstract class BasePeer { // ... public static function doDelete(Criteria $criteria, Connection $con) { // ... } } class AuthorPeer extends BasePeer { public static function doDelete(Criteria $criteria, $con = null) { if ($con === null) { $con = Transaction::begin(); } // ... parent::doDelete($criteria, $con); } } Now, even though I am using typehints propertly (i.e. not specifying one for $con in subclass), my code is no longer E_STRICT -- because the signatures do not match. :( Obviously issue is larger than the typehints, but it would be nice if the above code were able to be E_STRICT (especially since BasePeer is an abstract class) -- and it would be nice if I could use optional paramters w/ typehints. Of course, namespaces are more important than anything ;) Hans