Re: Proposal For Return-If / Early Return / Guard Clause Syntax
| From: | Ralph Schindler | Date: | Sun, 10 May 2020 19:59:46 +0000 |
| Subject: | Re: Proposal For Return-If / Early Return / Guard Clause Syntax | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-110116@lists.php.net to get a copy of this message | ||
On 5/10/20 1:56 PM, David Rodrigues wrote:
Suggestion: return if $x > 1; (to return "void") return $y if ($x > 1 && $x < 5); break if $x > 1; break 2 if $x > 1; throw new Exception if $x > 1;100% that will/should be a votable alternative option should this get to the voting phase. I have reasons for why I chose my initial path, but its worth mentioning I favor the optional value at the end maybe 65% to 35% where the value is after the initial keyword. Thanks for taking the time! -ralph schindler