Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69186 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65404 invoked from network); 18 Sep 2013 12:21:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2013 12:21:11 -0000 Authentication-Results: pb1.pair.com header.from=Frank.Liepert@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=Frank.Liepert@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.15.18 as permitted sender) X-PHP-List-Original-Sender: Frank.Liepert@gmx.de X-Host-Fingerprint: 212.227.15.18 mout.gmx.net Received: from [212.227.15.18] ([212.227.15.18:52282] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/C4-43258-6BA99325 for ; Wed, 18 Sep 2013 08:21:11 -0400 Received: from FrankPC ([84.155.5.32]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0MgGDK-1VbAjl0qZC-00Nljh for ; Wed, 18 Sep 2013 14:21:07 +0200 To: "'Leigh'" , References: In-Reply-To: Date: Wed, 18 Sep 2013 14:21:08 +0200 Message-ID: <001e01ceb469$8e5209f0$aaf61dd0$@Liepert@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac60VQWheDkUP9f3S6CP1r6ZpxF16wAEHO6A Content-Language: de X-Provags-ID: V03:K0:pTp/SnRP/NQV5DVrq/vzqPf/CIVPd46drKyBcD6+bivc+k9s9wy xBiyfgFCWpiOWEMxlFcQLSXj2IbJMibfj+rgJb9qHf7/iaascauQv++efgnM5uWJDlbF2xt cwy1hYCwRjwwRkZHPrlepPNMN3GmfVsuZTBJxFaE/3VylYpMyl987L9+dm1hQkmMQS8DxpM y+bQriUTznjAMhoRIbYhA== Subject: AW: [PHP-DEV] Allowing is_* functions to accept multiple parameters From: Frank.Liepert@gmx.de ("Frank Liepert") > function doStuffWithNumbers(...$numbers) { > if (!is_int(...$numbers)) { > throw new InvalidArgumentException('blah'); > ... > > Thoughts? Returning bool in this case will make it impossible to respond with a meaningful error message. Which of the provided arguments !is_int()? Instead, I would go with f.Ex.: $numbers = array(...$numbers); $result = array_filter($numbers, "is_int") and compare the arrays. Since the array keys are preserved, it's easy to find out, which argument !is_int(). Finally, the imho best solution would still be introducing optional scalar type hinting. But that is another topic and shouldn't be discussed here.