rfc:null-standalone-type
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:null-standalone-type [2021/10/02 14:55] – created girgias | rfc:null-standalone-type [2025/04/03 13:08] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: Allow null as standalone type ====== | ====== PHP RFC: Allow null as standalone type ====== | ||
- | * Version: 0.1 | + | * Version: 0.2 |
* Date: 2021-10-02 | * Date: 2021-10-02 | ||
* Author: George Peter Banyard, < | * Author: George Peter Banyard, < | ||
- | * Status: | + | * Status: |
* Target Version: PHP 8.2 | * Target Version: PHP 8.2 | ||
- | * Implementation: | + | * Implementation: |
* First Published at: [[http:// | * First Published at: [[http:// | ||
+ | * Superseded by: [[https:// | ||
===== Introduction ===== | ===== Introduction ===== | ||
Line 42: | Line 43: | ||
A method, from a built-in PHP class, which could benefit from declaring its return value as '' | A method, from a built-in PHP class, which could benefit from declaring its return value as '' | ||
+ | |||
+ | |||
+ | ==== Distinction between null and void ==== | ||
+ | |||
+ | A function always returns a value in PHP, even if its return type is declared as '' | ||
+ | is the value returned. The union type RFC did not include support for '' | ||
+ | |||
+ | < | ||
+ | The null type is only allowed as part of a union, and can not be used as a standalone type. Allowing it as a standalone type would make both < | ||
+ | </ | ||
+ | |||
+ | As explained previously, there are clear reasons as to why one may need to use '' | ||
+ | as '' | ||
+ | |||
+ | Moreover, a function which has a '' | ||
===== Proposal ===== | ===== Proposal ===== | ||
Line 54: | Line 70: | ||
} | } | ||
</ | </ | ||
+ | |||
==== Non-support for standalone-like usage of false ==== | ==== Non-support for standalone-like usage of false ==== | ||
Line 60: | Line 77: | ||
==== Redundancy of ?null ==== | ==== Redundancy of ?null ==== | ||
- | Trying to mark '' | + | Trying to mark '' |
+ | in line with PHP's current type resolving redundancy rules. | ||
==== Reflection ==== | ==== Reflection ==== | ||
Line 78: | Line 96: | ||
As per the voting RFC a yes/no vote with a 2/3 majority is needed for this proposal to be accepted. | As per the voting RFC a yes/no vote with a 2/3 majority is needed for this proposal to be accepted. | ||
- | ===== Patches and Tests ===== | + | ===== Implementation |
- | + | ||
- | Links to any external patches and tests go here. | + | |
- | If there is no patch, make it clear who will create a patch, or whether a volunteer to help with implementation is needed. | + | GitHub pull request: https:// |
- | + | ||
- | Make it clear if the patch is intended to be the final patch, or is just a prototype. | + | |
- | + | ||
- | For changes affecting the core language, you should also provide a patch for the language specification. | + | |
- | + | ||
- | ===== Implementation ===== | + | |
After the project is implemented, | After the project is implemented, |
rfc/null-standalone-type.1633186556.txt.gz · Last modified: 2025/04/03 13:08 (external edit)