Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57026 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58776 invoked from network); 22 Dec 2011 19:52:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Dec 2011 19:52:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=christian.kaps@mohiva.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=christian.kaps@mohiva.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mohiva.com from 80.67.29.28 cause and error) X-PHP-List-Original-Sender: christian.kaps@mohiva.com X-Host-Fingerprint: 80.67.29.28 smtprelay03.ispgateway.de Linux 2.6 Received: from [80.67.29.28] ([80.67.29.28:41705] helo=smtprelay03.ispgateway.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9E/60-12618-97A83FE4 for ; Thu, 22 Dec 2011 14:52:27 -0500 Received: from [87.181.70.70] (helo=[192.168.0.3]) by smtprelay03.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1Rdogg-0007PO-9A for internals@lists.php.net; Thu, 22 Dec 2011 20:52:22 +0100 Message-ID: <4EF38A75.40009@mohiva.com> Date: Thu, 22 Dec 2011 20:52:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111120 Thunderbird/8.0 MIME-Version: 1.0 To: PHPMailingList Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Df-Sender: Y2hyaXN0aWFuLmthcHNAbW9oaXZhLmNvbQ== Subject: Scalar Type Hint From: christian.kaps@mohiva.com (Christian Kaps) Hi internals, someone in the "Return Type Hinting for Methods RFC" thread had the idea of a "numeric" type hint. I will capture this idea and propose a "scalar" type hint. I understand the problem of the current discussion about scalar type hints(int, float, string, double, ...). But there should be a possibility to define a "scalar" type hint to restrict arguments to scalar types. function setName(scalar $name) {} class Foo { public function __toString() {} } setName(1) // pass setName(true) //pass setName('Christian') // pass setName(new Foo) // pass setName(array()) //fail setName(new stdClass) //fail Why this isn't possible? Christian