Re: Proposal For Return-If / Early Return / Guard Clause Syntax

From: Date: Sun, 10 May 2020 19:19:13 +0000
Subject: Re: Proposal For Return-If / Early Return / Guard Clause Syntax
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-110114@lists.php.net to get a copy of this message
Hello, I think that we SHOULD not introduce a new keyword (e. g. guard) since that would be a "major major" backwards incompatibility. "Guard" is a really generic word and a great example of that is Laravel and their authentication guards. In general, I don't think that early returns require a seperate syntax and/or block statement since a simple if (...) { return; } is already sufficient enough. Best regards, Benas Seliuginas

« previous php.internals (#110114) next »