PHP RFC: Support Internal function Return Types
- Version: 0.1
- Date: 2015-02-04
- Author: Reeze Xia, email@example.com
- Status: Under Discussion
- First Published at: http://wiki.php.net/rfc/internal_function_return_types
Since PHP 7 now have return types in user-land, but internal functions didn't support it. This RFC propose support internal function return types to make it consist.
Support declare internal function/method return types, this could help make internal functions API testable, this could also makes extension-implemented frameworks/libraries control their return types.
Backward Incompatible Changes
No BC break;
Proposed PHP Version(s)
To Existing Extensions
New Macro to support declare return types of functions/methods:
1. Should we raise E_CORE_ERROR when error detected, should we just ignore it with a warning?
2. Return Types RFC internally support Nullable Types, but user land not, this RFC also support that, should support it?
Unaffected PHP Functionality
User-land return types not affected
Proposed Voting Choices
This is not a BC break RFC, 50%+1 majority (see voting)
Patches and Tests
After the project is implemented, this section should contain
- the version(s) it was merged to
- a link to the git commit(s)
- a link to the PHP manual entry for the feature