Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10541 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75525 invoked by uid 1010); 16 Jun 2004 19:19:24 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 75477 invoked from network); 16 Jun 2004 19:19:24 -0000 Received: from unknown (HELO mx.thebrainroom.net) (65.200.24.98) by pb1.pair.com with SMTP; 16 Jun 2004 19:19:24 -0000 Received: by mx.thebrainroom.net (Postfix, from userid 517) id 03BFE1488148; Wed, 16 Jun 2004 12:18:59 -0700 (PDT) Received: from BAUMBART (pD95F88CF.dip.t-dialin.net [217.95.136.207]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by mx.thebrainroom.net (Postfix) with ESMTP id 9B9901488142; Wed, 16 Jun 2004 12:18:54 -0700 (PDT) Date: Wed, 16 Jun 2004 21:17:16 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <913185304.20040616211716@marcus-boerger.de> To: Ray Hilton Cc: Christian Schneider , mike@php.net, internals@lists.php.net In-Reply-To: <40D05892.6090804@memefeeder.com> References: <20040615112747.27402.qmail@pb1.pair.com> <40CEDECA.9040600@cschneid.com> <40D05892.6090804@memefeeder.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on jc.thebrainroom.net X-Spam-Status: No, hits=0.8 required=5.0 tests=PRIORITY_NO_NAME autolearn=no version=2.63 X-Spam-Level: X-TBR-Filter: Virus scanned and defanged Subject: Re: [PHP-DEV] Re: ClassHints and NULL From: helly@php.net (Marcus Boerger) Hello Ray, Wednesday, June 16, 2004, 4:26:26 PM, you wrote: > Hi all, [....] - NOTHING stops you from passing NULL to functions. - Typhints are a shortcut for an 'instanceof'`test - now try NULL instanceof stdclass: php-cvs $ php -r 'var_dump(NULL instanceof stdclass);' bool(false) - what you probablywant is function bla($x) { if (is_null($x)) { // handle null } else if ($x instanceof whatever) { // handle instance } else { // handle error } } - if you look again you'll see that you are doing *three different* things in your code. Typehints have a different usage! best regards marcus