Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57041 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91377 invoked from network); 22 Dec 2011 23:28:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Dec 2011 23:28:38 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.203 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.203 smtp203.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.203] ([67.192.241.203:39389] helo=smtp203.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CD/B6-12618-52DB3FE4 for ; Thu, 22 Dec 2011 18:28:37 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp10.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 2F6861B817D; Thu, 22 Dec 2011 18:28:34 -0500 (EST) X-Virus-Scanned: OK Received: by smtp10.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id C8B6A1B80F7; Thu, 22 Dec 2011 18:28:33 -0500 (EST) Message-ID: <4EF3BD21.2040301@sugarcrm.com> Date: Thu, 22 Dec 2011 15:28:33 -0800 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Will Fitch CC: =?UTF-8?B?w4FuZ2VsIEdvbnrDoWxleg==?= , PHP Developers Mailing List 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> In-Reply-To: <-2451498990672032588@unknownmsgid> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Return Type Hinting for Methods RFC From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > Most modern languages allow returning null in any case. This is a hail > Mary in the event something happens, but throwing an exception is > inappropriate. I see no reason to diverge from that. In PHP, returning object if everything is OK and false if not is a very common pattern. Also, you understand that always allowing null means that this construct: $foo = $this->returnsFoo(); $foo->fooMethod(); is no longer safe as you wanted it to be when you made returnsFoo use strict typing? You'd have to check $foo anyway. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227