Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92599 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87518 invoked from network); 21 Apr 2016 16:33:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Apr 2016 16:33:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=mails@thomasbley.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=mails@thomasbley.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain thomasbley.de from 85.13.128.151 cause and error) X-PHP-List-Original-Sender: mails@thomasbley.de X-Host-Fingerprint: 85.13.128.151 dd1730.kasserver.com Received: from [85.13.128.151] ([85.13.128.151:42800] helo=dd1730.kasserver.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8A/42-14036-1E009175 for ; Thu, 21 Apr 2016 12:33:37 -0400 Received: from dd1730.kasserver.com (dd0803.kasserver.com [85.13.146.34]) by dd1730.kasserver.com (Postfix) with ESMTPSA id 368CF1A80188; Thu, 21 Apr 2016 18:33:34 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SenderIP: 217.240.29.251 User-Agent: ALL-INKL Webmail 2.11 In-Reply-To: <31.BF.14036.A61D8175@pb1.pair.com> References: <570F4BB4.6020709@zend.com> <57112225.6020905@thefsb.org> <57119B5E.6070205@thefsb.org> ,,<20160420165307.9C86E1A83D08@dd1730.kasserver.com><31.BF.14036.A61D8175@pb1.pair.com> To: guilhermeblanco@gmail.com, cornelius.howl@gmail.com, dmitry@zend.com, fsb@thefsb.org Cc: internals@lists.php.net Message-ID: <20160421163334.368CF1A80188@dd1730.kasserver.com> Date: Thu, 21 Apr 2016 18:33:34 +0200 (CEST) Subject: Re: [PHP-DEV] [RFC] Nullable Types From: mails@thomasbley.de ("Thomas Bley") Hello Tom, with default return value I mean to return a certain value if nothing else is returned (similar to method parameters with a default value). example 1: declare(strict_types=0); function my_strpos(string $haystack, string $needle): int = false { return 42; // return 42 return false; // return false return true; // return 1 return; // return false } example 2: declare(strict_types=1); function my_strpos(string $haystack, string $needle): int = false { return 42; // return 42 return false; // return false return true; // fatal error return; // return false } Regards Thomas fsb@thefsb.org wrote on 21.04.2016 15:05: > Hi Thomas, > > > What is a default return declaration? Is this for branches within the function > that do not lead to a return statement? > > > Tom > > > > > > From: Thomas Bley > Sent: ‎Wednesday‎, ‎April‎ ‎20‎, ‎2016 ‎12‎:‎53‎ ‎PM > To: guilhermeblanco@gmail.com, cornelius.howl@gmail.com, dmitry@zend.com > Cc: fsb@thefsb.org, internals@lists.php.net > > > > > > What do you think about default return values? > > e.g. > > function foo(): db_result = null { > } > > function canLogin(): bool = false { > }