rfc:switch_expression
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:switch_expression [2020/03/28 00:59] – created ilijatovilo | rfc:switch_expression [2020/03/28 15:25] – Delete extra opening parenthesis guilliamxavier | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: Switch expression ====== | ====== PHP RFC: Switch expression ====== | ||
* Date: 2020-03-28 | * Date: 2020-03-28 | ||
- | * Author: Ilija Tovilo, | + | * Author: Ilija Tovilo, tovilo.ilija@gmail.com |
- | * Status: | + | * Author: Michał Brzuchalski, |
+ | * Status: | ||
* Target Version: PHP 8.0 | * Target Version: PHP 8.0 | ||
* Implementation: | * Implementation: | ||
+ | * Previous RFC: https:// | ||
===== Introduction ===== | ===== Introduction ===== | ||
Line 118: | Line 120: | ||
</ | </ | ||
- | The fallthrough behavior can't reasonably be changed in the '' | + | The fallthrough behavior can't reasonably be changed in the '' |
==== Inexhaustiveness ==== | ==== Inexhaustiveness ==== | ||
Line 169: | Line 171: | ||
<code php> | <code php> | ||
- | $x = switch ($y) {} | + | $x = switch ($y) {}; |
// instead of | // instead of | ||
- | $x = $y switch {} | + | $x = $y switch {}; |
</ | </ | ||
Line 187: | Line 189: | ||
===== "Why don't you just use x" ===== | ===== "Why don't you just use x" ===== | ||
- | The have been some comments on how you can already achieve the same result. | + | There have been some comments on how you can already achieve the same result. |
==== if statements ==== | ==== if statements ==== | ||
Line 216: | Line 218: | ||
$y = $x === 1 ? ... | $y = $x === 1 ? ... | ||
: ($x === 2 ? ... | : ($x === 2 ? ... | ||
- | : (($x === 3 ? ... | + | : ($x === 3 ? ... |
: 0)); | : 0)); | ||
</ | </ |
rfc/switch_expression.txt · Last modified: 2020/04/12 00:04 by ilijatovilo