rfc:conditional_break_continue_return
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:conditional_break_continue_return [2020/05/16 19:18] – ralphschindler | rfc:conditional_break_continue_return [2020/05/16 19:20] – ralphschindler | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== PHP RFC: Your Title Here ====== | + | ====== PHP RFC: Conditional Break, Continue, and Return Statements |
- | * Version: | + | * Version: |
- | * Date: 2013-02-24 (use today' | + | * Date: 2020-05-16 |
* Author: Ralph Schindler, ralphschindler@php.net | * Author: Ralph Schindler, ralphschindler@php.net | ||
* Status: Draft | * Status: Draft | ||
Line 45: | Line 45: | ||
In short [I perceive], a benefit of using guard clauses is to avoid deeply nested conditionals and to avoid increasing cognitive complexity in a function or method. Utilizing this technique in code results in code that is more easily code reviewable and easier to determine possible code paths that exists from the top to the bottom of a function or method. | In short [I perceive], a benefit of using guard clauses is to avoid deeply nested conditionals and to avoid increasing cognitive complexity in a function or method. Utilizing this technique in code results in code that is more easily code reviewable and easier to determine possible code paths that exists from the top to the bottom of a function or method. | ||
- | Over the past few years, I've seen a growing number of blog posts, conference talks, and even tooling (for example code complexity scoring), that suggest writing guard clauses is a good practice to utilize. | + | Over the past few years, I've seen a growing number of blog posts, conference talks, and even tooling (for example code complexity scoring), that suggest writing guard clauses is a good practice to utilize. |
- | see abort_if/ | + | It is also worth mentioning that Ruby has similar features (called a modifier), and I believe they are heavily utilized.. [[https:// |
- | + | ||
- | It is also worth mentioning that Ruby has similar features (called a modifier), and I believe they are heavily utilized: | + | |
- | + | ||
- | see: https:// | + | |
==== Variation #1 ==== | ==== Variation #1 ==== |
rfc/conditional_break_continue_return.txt · Last modified: 2022/04/17 18:38 by ilutov