Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110149 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 39388 invoked from network); 13 May 2020 11:05:31 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 May 2020 11:05:31 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5DE261804E1 for ; Wed, 13 May 2020 02:42:25 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS12876 195.154.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from smtp.opensides.be (smtp.fusiondirectory.org [195.154.20.141]) by php-smtp4.php.net (Postfix) with ESMTP for ; Wed, 13 May 2020 02:42:24 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by smtp.opensides.be (Postfix) with ESMTP id D1313154B4E for ; Wed, 13 May 2020 11:42:21 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at opensides.be Received: from smtp.opensides.be ([127.0.0.1]) by localhost (smtp.opensides.be [127.0.0.1]) (amavisd-new, port 10024) with LMTP id a-qVZ-JjOZ82 for ; Wed, 13 May 2020 11:42:19 +0200 (CEST) Received: from mcmic-probook.opensides.be (194.129.16.109.rev.sfr.net [109.16.129.194]) by smtp.opensides.be (Postfix) with ESMTPSA id 3B1BC154B4B for ; Wed, 13 May 2020 11:42:19 +0200 (CEST) Date: Wed, 13 May 2020 11:42:17 +0200 To: PHP internals Message-ID: <20200513114217.01c43b97@mcmic-probook.opensides.be> In-Reply-To: References: Organization: FusionDirectory X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Proposal For Return-If / Early Return / Guard Clause Syntax From: come.chilliet@fusiondirectory.org (=?UTF-8?B?Q8O0bWU=?= Chilliet) Le Sun, 10 May 2020 10:49:15 -0500, Ralph Schindler a =C3=A9crit : > The chosen syntax is: >=20 > return if ( if_expr ) [: optional_return_expression] ; >=20 > As a contrived example: >=20 > function divide($dividend, $divisor =3D null) { > return if ($divisor =3D=3D=3D null || $divisor =3D=3D=3D 0); >=20 > return $dividend / $divisor; > } I do not understand the point, you are just reordering keywords, why is that better than already correct code: function divide($dividend, $divisor =3D null) { if ($divisor =3D=3D=3D null || $divisor =3D=3D=3D 0) return; =20 return $dividend / $divisor; } I do not think an RFC and a special keyword are justified just to move the word "return" from end to beginning of line.