Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37016 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14882 invoked from network); 15 Apr 2008 08:27:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Apr 2008 08:27:25 -0000 Authentication-Results: pb1.pair.com header.from=arvids.godjuks@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=arvids.godjuks@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 66.249.92.171 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: arvids.godjuks@gmail.com X-Host-Fingerprint: 66.249.92.171 ug-out-1314.google.com Received: from [66.249.92.171] ([66.249.92.171:63127] helo=ug-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/41-06355-CE664084 for ; Tue, 15 Apr 2008 04:27:25 -0400 Received: by ug-out-1314.google.com with SMTP id u40so649856ugc.29 for ; Tue, 15 Apr 2008 01:27:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=R7E2jc/RA/9WdG6OVwvJyYGna4kMJN6LIICN6mRT/xs=; b=tmiFPMeTJWVr9ztYIbjQyzUB3B70HBSds0T+yx9Cimc36o2j7UmtuS48hISKImYrZWSvdl4Z7kIP45ueNFCFqpnns2NDi+ffYKYKQtMqb/Yk41W9xF9vTvZbyyHoxNmpYfqCnttYSj45RJUCbsoRe64+j1Sef8TR2Q3b9hELcII= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=FUA/1vv5tq2T/ejOBlYM6F2yKi30Sq5+3MnqOF/fuqekeu6xScMUlPdo5NZ/d9nZu2eOaTh2/5UHJ+hNuzMjYLbK29O39G6OxKpTkUsJHWZbVIZTebDein7N6HmxDLBfuI891BlUjAVN5ZQqy1i2N2MSmhXRV1Oq/XFn+b/w4dU= Received: by 10.66.224.19 with SMTP id w19mr5110200ugg.34.1208248041480; Tue, 15 Apr 2008 01:27:21 -0700 (PDT) Received: by 10.66.219.9 with HTTP; Tue, 15 Apr 2008 01:27:21 -0700 (PDT) Message-ID: <9b3df6a50804150127h49548d34g72d2f0b5d7f6e884@mail.gmail.com> Date: Tue, 15 Apr 2008 11:27:21 +0300 To: "Sam Barrow" Cc: "Lukas Kahwe Smith" , "Christian Schneider" , "Chris Stockton" , "PHP Developers Mailing List" In-Reply-To: <1208235938.8817.14.camel@sams-room> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_22783_14618781.1208248041472" References: <1207539695.5736.42.camel@pena> <5CB53203-F3E5-46F2-89A8-F331B2CB9017@pooteeweet.org> <47FA60F8.7060702@zend.com> <37C655F0-D212-420C-9320-7953A69C5EDB@pooteeweet.org> <48036A0C.7070203@cschneid.com> <7356DD7D-2501-49CB-9428-758DCF674691@cschneid.com> <6A76B92D-3901-4A4E-975F-C7C0F36FD1D9@pooteeweet.org> <1208235938.8817.14.camel@sams-room> Subject: Re: [PHP-DEV] Return type hints From: arvids.godjuks@gmail.com ("Arvids Godjuks") ------=_Part_22783_14618781.1208248041472 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thouse who are asking about type hinting for function args are right. It is logical to implement return type hinting with arg type hinting. They should work either independantly (you can specify any on them or all together) or if you declare return type - declare arg types too (then we should have 'mixed' type too, some functions can return array or false on error, ect). Why we need type hinting? Here is an example array function myQuery(int $id){ $result = mysql_query('SELECT * FROM table WHERE id = '.$id); // Make a array from result return $array; } $id = '192b46'; $data = myQuery($id); If some checks are implemented about what is passed, then this will be an error (or exception witch can be cathed). And type conversion to int isn't good, because you will get 192 instead if 19246. It's like array and object type hinting now implemented. And i can be sure I will get an array as a result. Maybe it is good idea to make type conversions on function args, then we don't need to make "id = '.(int)$id" ourselfs. ------=_Part_22783_14618781.1208248041472--