rfc:switch-expression-and-statement-improvement
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:switch-expression-and-statement-improvement [2019/09/26 13:45] – created brzuchal | rfc:switch-expression-and-statement-improvement [2020/07/22 08:39] (current) – Changed status brzuchal | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== PHP RFC: Your Title Here ====== | + | ====== PHP RFC: Switch Expression & Switch Statement Improvement |
* Version: 1.0 | * Version: 1.0 | ||
* Date: 2019-09-12 | * Date: 2019-09-12 | ||
* Author: Michał Brzuchalski < | * Author: Michał Brzuchalski < | ||
- | * Status: | + | * Status: |
* First Published at: https:// | * First Published at: https:// | ||
Line 22: | Line 22: | ||
<?php | <?php | ||
- | switch (date(" | + | switch (date(" |
case 0: | case 0: | ||
$say = " | $say = " | ||
+ | break; | ||
case 1: | case 1: | ||
case 2: | case 2: | ||
Line 47: | Line 48: | ||
<?php | <?php | ||
- | switch (date(" | + | switch (date(" |
case 0: | case 0: | ||
$say = " | $say = " | ||
+ | break; | ||
case 1, 2, 3, 4, 5: | case 1, 2, 3, 4, 5: | ||
$say = " | $say = " | ||
Line 82: | Line 84: | ||
==== Return type ==== | ==== Return type ==== | ||
- | The nature of switch expression | + | The switch expression |
- | type-hint to enforce result | + | |
<code php> | <code php> | ||
Line 98: | Line 99: | ||
==== Non-completeness ==== | ==== Non-completeness ==== | ||
- | The nature of switch | + | The witch statement returning |
- | results in RuntimeException if none of the labels evaluated on a match. | + | |
<code php> | <code php> |
rfc/switch-expression-and-statement-improvement.1569505540.txt.gz · Last modified: 2019/09/26 13:45 by brzuchal