rfc:noreturn_type

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
Next revisionBoth sides next revision
rfc:noreturn_type [2021/03/10 18:09] – No space before type mattbrownrfc:noreturn_type [2021/03/31 13:47] – Make naming section more honest mattbrown
Line 3: Line 3:
   * Date: 2021-03-10   * Date: 2021-03-10
   * Author: Matt Brown <php@muglug.com> & Ondřej Mirtes <ondrej@mirtes.cz>   * Author: Matt Brown <php@muglug.com> & Ondřej Mirtes <ondrej@mirtes.cz>
-  * Status: Under Discussion+  * Status: Voting
   * Proposed Version: PHP 8.1   * Proposed Version: PHP 8.1
   * Implementation: https://github.com/php/php-src/pull/6761   * Implementation: https://github.com/php/php-src/pull/6761
Line 123: Line 123:
 { {
     public function execute(): void {} // Fatal error     public function execute(): void {} // Fatal error
 +}
 +</code>
 +
 +Returning by reference with a ''noreturn'' type is allowed as well.
 +
 +<code php>
 +class A {
 +    public function &test(): int { ... }
 +}
 +class B extends A {
 +    public function &test(): noreturn { throw new Exception; }
 +}
 +</code>
 +
 +Returning ''noreturn'' is also allowed in %%__%%toString methods:
 +
 +<code php>
 +class A implements Stringable {
 +    public function __toString(): string {
 +        return "hello";
 +    }
 +}
 +
 +class B extends A {
 +    public function __toString(): noreturn {
 +        throw new \Exception('not supported');
 +    }
 } }
 </code> </code>
Line 198: Line 225:
 ==== Naming ==== ==== Naming ====
  
-Naming is hard, but we believe ''noreturn'' is the best name for this type.+Naming is hard. We each have different preferences.
  
 Arguments for ''noreturn'': Arguments for ''noreturn'':
Line 222: Line 249:
 Draft implementation here: https://github.com/php/php-src/pull/6761 Draft implementation here: https://github.com/php/php-src/pull/6761
  
-===== Proposed Voting Choices =====+===== Vote ===== 
 + 
 +Voting opens 2021-03-30 and 2021-04-13 at 11:00:00 AM EDT. 2/3 required to accept. 
 + 
 +<doodle title="Add noreturn type" auth="mattbrown" voteType="single" closed="false"> 
 +   * Yes 
 +   * No 
 +</doodle> 
 + 
 +Following vote requires simple majority:
  
-Yes/no vote for adding ''noreturn''+<doodle title="noreturn vs never" auth="mattbrown" voteType="single" closed="false"> 
 +   * noreturn 
 +   * never 
 +</doodle>
rfc/noreturn_type.txt · Last modified: 2021/04/19 09:31 by nikic