rfc:nullable_return_types
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:nullable_return_types [2016/04/06 15:53] – created dmitry | rfc:nullable_return_types [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2016-04-06 | * Date: 2016-04-06 | ||
* Author: Dmitry Stogov, dmitry@zend.com | * Author: Dmitry Stogov, dmitry@zend.com | ||
- | * Status: | + | * Status: |
* First Published at: https:// | * First Published at: https:// | ||
Line 58: | Line 58: | ||
</ | </ | ||
- | Usage of the same **?< | + | ==== Nullable Arguments without Default Values ==== |
- | Actually, arguments already may be declared as " | + | |
- | This decision(s) may be done separately. | + | Usage of the same **?< |
+ | |||
+ | < | ||
+ | function foo(int $a = null) { // already works in 7.0 | ||
+ | } | ||
+ | |||
+ | function foo(?int $a) { // we may make this work as well | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== Inherited Method Compatibility Rules ==== | ||
+ | |||
+ | Nullable types won't change anything in inherited method compatibility rules. We will still use Covariance for return types and Contravariance for arguments. This means, that methods with nullable return types may be overridden by methods with non-nullable, | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 72: | Line 84: | ||
===== Future Scope ===== | ===== Future Scope ===== | ||
- | |||
- | ==== Nullable Arguemnts without Default Values ==== | ||
- | |||
- | This RFC doesn' | ||
- | |||
- | < | ||
- | function foo(?int $a) { | ||
- | } | ||
- | </ | ||
==== Union Types ==== | ==== Union Types ==== | ||
Line 91: | Line 94: | ||
</ | </ | ||
- | ===== Proposed Voting Choices ===== | + | I don't see a big reason to extend PHP with both possible syntaxes, so this RFC competes with "Union Types" |
- | Simple | + | |
+ | ===== Proposed Voting Choices ===== | ||
The vote will start on April 25 and finish on May 9. | The vote will start on April 25 and finish on May 9. | ||
+ | |||
+ | <doodle title=" | ||
+ | * yes | ||
+ | * no | ||
+ | </ | ||
+ | |||
+ | <doodle title=" | ||
+ | * yes | ||
+ | * no | ||
+ | </ | ||
+ | |||
+ | |||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
Line 110: | Line 125: | ||
- [[https:// | - [[https:// | ||
- [[https:// | - [[https:// | ||
+ | - [[https:// | ||
rfc/nullable_return_types.1459958039.txt.gz · Last modified: 2017/09/22 13:28 (external edit)