Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82999 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28314 invoked from network); 17 Feb 2015 18:56:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2015 18:56:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=francois@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=francois@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.27.42.2 as permitted sender) X-PHP-List-Original-Sender: francois@php.net X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Received: from [212.27.42.2] ([212.27.42.2:31536] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D0/00-28194-6BE83E45 for ; Tue, 17 Feb 2015 13:55:51 -0500 Received: from moorea (unknown [82.240.16.115]) by smtp2-g21.free.fr (Postfix) with ESMTP id 6569C4B023B; Tue, 17 Feb 2015 19:55:30 +0100 (CET) Reply-To: To: , "'Anthony Ferrara'" , "'Zeev Suraski'" Cc: "'Sara Golemon'" , "'PHP internals'" References: <011801d04a07$83ab1c00$8b015400$@php.net> <016f01d04a3a$e9183220$bb489660$@php.net> <022801d04ab1$4a0c47d0$de24d770$@php.net> <1913e09d7f52541901d8574d2080a63f@mail.gmail.com> <025f01d04ad9$a77a8e90$f66fabb0$@php.net> In-Reply-To: <025f01d04ad9$a77a8e90$f66fabb0$@php.net> Date: Tue, 17 Feb 2015 19:55:45 +0100 Message-ID: <027601d04ae3$565f6b70$031e4250$@php.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQGD0sLDaA+/0NIeBlQhQC5OtPA/xwHih9+6AanvcsEBj7eMCwEU0CpMAs0H7+gBDwGZjwJNu28fAX8sxVQCZjw3kp0MHttw Content-Language: fr X-Antivirus: avast! (VPS 150217-1, 17/02/2015), Outbound message X-Antivirus-Status: Clean Subject: RE: [PHP-DEV] Reviving scalar type hints From: francois@php.net (=?utf-8?Q?Fran=C3=A7ois_Laupretre?=) > De : Fran=C3=A7ois Laupretre [mailto:francois@php.net] > > This way, the user can write : >=20 > function convertToInt(string $number): int! { <- int! instead of int > if (!preg_match("(^[0-9]{1,17}$)", $number)) { > throw new InvalidArgumentException("Supplied argument is not = a valid > number"); > } > return $number; A static analyzer would raise an error on this, as we are sure it fails, = while : function convertToInt(string $number): int! { if (!preg_match("(^[0-9]{1,17}$)", $number)) { throw new InvalidArgumentException("Supplied argument is not a = valid number"); } return (int)$number; would be analyzed as OK. That's what you want, don't you ? Regards Fran=C3=A7ois