On Tue, Nov 26, 2024 at 2:18 PM Christoph M. Becker <cmbecke...@gmx.de> wrote:
> What's wrong with > > if (!$result['success']) return $result; > > Christoph > I don't think I'm in favour of the proposal as I think it's high effort for little gain, but to me this "alternative" requires you to mentally parse a conditional statement and then pay attention to its consequence, which is an afterthought and can be a return, but can also be anything else. The proposed syntax seems superior because the first thing the developer is presented with is the fact that this is a return statement / end of the block, but under a specific condition, which is a secondary artifact. Working with early returns and fail-early approaches, I have to agree that the proposed syntax is superior than this alternative and not just because of current coding standards, but more on the semantics of how to go about the statement itself. But as I stated, it doesn't feel like the effort is worth the benefit because even if this could be implemented in a 1-line-of-code on php-src, it still means syntax change which will affect tooling and cause a ton of open-source overhead with token_get_all() changes, etc. -- Marco Deleu