Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34448 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22006 invoked by uid 1010); 4 Jan 2008 19:00:20 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 21991 invoked from network); 4 Jan 2008 19:00:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jan 2008 19:00:19 -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:34510] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 60/1E-63281-2428E774 for ; Fri, 04 Jan 2008 14:00:19 -0500 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 4 Jan 2008 21:00:01 +0200 Received: from [192.168.16.90] ([192.168.16.90]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 4 Jan 2008 10:59:58 -0800 Message-ID: <477E822E.30108@zend.com> Date: Fri, 04 Jan 2008 10:59:58 -0800 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Sam Barrow CC: internals Mailing List References: <477DB7BF.10201@chiaraquartet.net> <20080104105558.GC7861@mint.phcomp.co.uk> <477E5649.2080104@chiaraquartet.net> <1199466070.15292.140.camel@sbarrow-desktop> <1199466701.15292.149.camel@sbarrow-desktop> <477E7AC3.20009@zend.com> <1199472405.15292.181.camel@sbarrow-desktop> In-Reply-To: <1199472405.15292.181.camel@sbarrow-desktop> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 04 Jan 2008 18:59:58.0155 (UTC) FILETIME=[002E31B0:01C84F04] Subject: Re: [PHP-DEV] type hinting From: stas@zend.com (Stanislav Malyshev) > Not necessarily, if you have a function that performs a generic > operation on any object. As for resources you are right, it might be Like what? I don't know many operations that are good for any object and only object and need special function to perform them. Actually, excluding scenarios like serialization and RPC (which should take care of other types too so irrelevant here) I can't think of any right now. > ideal to have "mysql resource" rather than just "resource", but just > having the "resource" type hint is better than having no type hint. No, it's not better. Having GD image instead of mysql connection is not better than having integer in any way. It would just produce different error message, so what? > This is one that I find very useful, much more than it may seem. I use > scalar for any type of post/get input, printed output, or DB > interaction, as objects/arrays/resources cannot be printed or stored in > a database in a standardized way. If you need serialization/printing, you have serialize() and __toString() with respective handlers. If you reimplementing them and using scalar restrictions, you most probably do it wrong. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com