rfc:arrow_functions
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
rfc:arrow_functions [2017/01/30 17:50] levim Pointless revision to get previous revision number |
rfc:arrow_functions [2018/06/28 14:35] levim Withdraw |
||
---|---|---|---|
Line 4: | Line 4: | ||
* Author: Levi Morrison < | * Author: Levi Morrison < | ||
* Author: Bob Weinand < | * Author: Bob Weinand < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 63: | Line 63: | ||
==== Type Declarations ==== | ==== Type Declarations ==== | ||
This RFC does support type declarations for parameters and return types. This issue was noted multiple times on the mailing list during the short closures RFC as something that bothered voters. Therefore this RFC permits them but the authors discourage their general use in arrow functions. | This RFC does support type declarations for parameters and return types. This issue was noted multiple times on the mailing list during the short closures RFC as something that bothered voters. Therefore this RFC permits them but the authors discourage their general use in arrow functions. | ||
+ | |||
+ | Here are some examples to show the syntax: | ||
+ | |||
+ | <PHP> | ||
+ | fn (array $x) => $x | ||
+ | fn (): int => 42 | ||
+ | </ | ||
==== References ==== | ==== References ==== | ||
- | Parameters and return values can be passed/ | + | Parameters and return values can be passed/ |
+ | |||
+ | < | ||
+ | fn &(array &$xs) => $xs | ||
+ | </ | ||
==== Static Arrow Functions ==== | ==== Static Arrow Functions ==== | ||
Line 75: | Line 86: | ||
Unfortunately the '' | Unfortunately the '' | ||
- | Ilija Tovilo analyzed the top 1,000 PHP repositories on GitHub to find usages of '' | + | Ilija Tovilo analyzed the top 1,000 PHP repositories on GitHub to find usages of '' |
==== Patches and Tests ==== | ==== Patches and Tests ==== |
rfc/arrow_functions.txt · Last modified: 2018/06/28 14:35 by levim