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.
See: https://github.com/php/php-src/pull/1050/files#diff-3ea93da7d1026a9f53948a5d14b1f7bdR247
No BC break;
PHP 7
No
No
No
New Macro to support declare return types of functions/methods:
- ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO()
- ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX()
None
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?
User-land return types not affected
None
This is not a BC break RFC, 50%+1 majority (see voting)
After the project is implemented, this section should contain
None