rfc:noreturn_type
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:noreturn_type [2021/03/10 18:09] – No space before type mattbrown | rfc:noreturn_type [2021/04/19 09:31] (current) – nikic | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2021-03-10 | * Date: 2021-03-10 | ||
* Author: Matt Brown < | * Author: Matt Brown < | ||
- | * Status: | + | * Status: |
* Proposed Version: PHP 8.1 | * Proposed Version: PHP 8.1 | ||
* Implementation: | * Implementation: | ||
Line 9: | Line 9: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | There has been a trend over the past few years that concepts initially just expressed in PHP docblocks eventually become native PHP types. | + | There has been a trend over the past few years that concepts initially just expressed in PHP docblocks eventually become native PHP types. Past examples are: [[https:// |
- | + | ||
- | Past examples are: [[https:// | + | |
Our static analysis tools currently provide support for '' | Our static analysis tools currently provide support for '' | ||
Line 123: | Line 121: | ||
{ | { | ||
public function execute(): void {} // Fatal error | public function execute(): void {} // Fatal error | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Returning by reference with a '' | ||
+ | |||
+ | <code php> | ||
+ | class A { | ||
+ | public function & | ||
+ | } | ||
+ | class B extends A { | ||
+ | public function & | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Returning '' | ||
+ | |||
+ | <code php> | ||
+ | class A implements Stringable { | ||
+ | public function __toString(): | ||
+ | return " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | class B extends A { | ||
+ | public function __toString(): | ||
+ | throw new \Exception(' | ||
+ | } | ||
} | } | ||
</ | </ | ||
Line 198: | Line 223: | ||
==== Naming ==== | ==== Naming ==== | ||
- | Naming is hard, but we believe '' | + | Naming is hard. We each have different preferences. |
Arguments for '' | Arguments for '' | ||
Line 222: | Line 247: | ||
Draft implementation here: https:// | Draft implementation here: https:// | ||
- | ===== 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=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | Following vote requires simple majority: | ||
- | Yes/no vote for adding '' | + | <doodle title=" |
+ | * noreturn | ||
+ | * never | ||
+ | </ |
rfc/noreturn_type.1615399754.txt.gz · Last modified: 2021/03/10 18:09 by mattbrown