Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57057 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48767 invoked from network); 23 Dec 2011 12:10:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Dec 2011 12:10:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=johncrenshaw@priacta.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=johncrenshaw@priacta.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain priacta.com designates 64.95.72.243 as permitted sender) X-PHP-List-Original-Sender: johncrenshaw@priacta.com X-Host-Fingerprint: 64.95.72.243 mxout.myoutlookonline.com Received: from [64.95.72.243] ([64.95.72.243:22397] helo=mxout.myoutlookonline.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4C/C0-40830-AAF64FE4 for ; Fri, 23 Dec 2011 07:10:19 -0500 Received: from mxout.myoutlookonline.com (localhost [127.0.0.1]) by mxout.myoutlookonline.com (Postfix) with ESMTP id 507067B8815; Fri, 23 Dec 2011 07:10:16 -0500 (EST) X-Virus-Scanned: by SpamTitan at mail.lan Received: from HUB023.mail.lan (unknown [10.110.2.1]) by mxout.myoutlookonline.com (Postfix) with ESMTP id DD6AD7B87E3; Fri, 23 Dec 2011 07:10:15 -0500 (EST) Received: from MAILR001.mail.lan ([10.110.18.27]) by HUB023.mail.lan ([10.110.17.23]) with mapi; Fri, 23 Dec 2011 07:10:02 -0500 To: Will Fitch , Stas Malyshev , PHP Developers Mailing List CC: =?iso-8859-1?Q?=C1ngel_Gonz=E1lez?= Date: Fri, 23 Dec 2011 07:10:10 -0500 Thread-Topic: [PHP-DEV] Return Type Hinting for Methods RFC Thread-Index: AczBFp3x0eIOApP7TzeiPRG8eHQWxQAU6SwA Message-ID: References: <2095305E-D4E3-4D7E-8218-32EE99688E0C@GMAIL.COM> <2C90FB94-38C4-4270-8C6A-B89304BA8ED8@gmail.com> <159A7CA2-8561-40DA-9434-CAAE12304DDB@gmail.com> <4EF3B56A.4040809@gmail.com> <-2451498990672032588@unknownmsgid> <4EF3BD21.2040301@sugarcrm.com> <-6952580475866195972@unknownmsgid> <4EF3C7F7.9010404@sugarcrm.com> <4841689055873111589@unknownmsgid> <4EF3D18B.7040900@sugarcrm.com> <11CFB4E4-F2DA-4766-AA23-D08180C3910B@gmail.com> In-Reply-To: <11CFB4E4-F2DA-4766-AA23-D08180C3910B@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: RE: [PHP-DEV] Return Type Hinting for Methods RFC From: johncrenshaw@priacta.com (John Crenshaw) > From: Will Fitch [mailto:will.fitch@gmail.com]=20 > > I would like to take this opportunity to query on a consensus: > > Would you prefer to allow methods with type hinted return values to retur= n null at will, or add a marker noting that it *may* return null? > > Example: Return null at will > > public ArrayIterator getIterator() > { > // something happened, will return null > return null; > } > > Example: Return only if identified as such > > public ArrayIterator? getIterator() > { > return null; > } I hate the syntax in the second example (using ?). IMO allowing null should be the default unless specifically disallowed. I far prefer the addition/use of a keyword ("notnull" or "null") to disallo= w (or allow) as opposed to random symbol abuse (potential incompatibilities= notwithstanding). John Crenshaw Priacta, Inc.