rfc:switch-expression-and-statement-improvement

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:switch-expression-and-statement-improvement [2019/09/26 14:06] – fixed missing parens brzuchalrfc:switch-expression-and-statement-improvement [2020/07/22 08:39] (current) – Changed status brzuchal
Line 3: Line 3:
   * Date: 2019-09-12   * Date: 2019-09-12
   * Author: Michał Brzuchalski <brzuchal@php.net>   * Author: Michał Brzuchalski <brzuchal@php.net>
-  * Status: Draft+  * Status: Withdrawn
   * First Published at: https://wiki.php.net/rfc/switch-expression-and-statement-improvement   * First Published at: https://wiki.php.net/rfc/switch-expression-and-statement-improvement
  
Line 25: Line 25:
   case 0:   case 0:
     $say = "weekend!";     $say = "weekend!";
 +    break;
   case 1:   case 1:
   case 2:   case 2:
Line 50: Line 51:
   case 0:   case 0:
     $say = "weekend!";     $say = "weekend!";
 +    break;
   case 1, 2, 3, 4, 5:   case 1, 2, 3, 4, 5:
     $say = "weekday :(";     $say = "weekday :(";
Line 82: Line 84:
 ==== Return type ==== ==== Return type ====
  
-The nature of switch expression which returns matched expression block allows specifying an optional return  +The switch expression errors with ''RuntimeException'' if return type given and there is a type mismatch.
-type-hint to enforce result type restriction.+
  
 <code php> <code php>
Line 98: Line 99:
 ==== Non-completeness ==== ==== Non-completeness ====
  
-The nature of switch statement returning always a value which must match optional type-hint if given +The witch statement returning errors with ''RuntimeException'' if none of the labels evaluated on a match.
-results in RuntimeException if none of the labels evaluated on a match.+
  
 <code php> <code php>
rfc/switch-expression-and-statement-improvement.1569506819.txt.gz · Last modified: 2019/09/26 14:06 by brzuchal