So far, every PHP type is supported by both parameter typehints and return types, except resources. This RFC should close this gap.
The ``resource`` typehint and return type should be added to the engine, working the same way like ``is_resource()`` does. This would also mean to make ``resource`` a reserved classname.
function should_return_resource(): resource { return true; // Return value of should_return_resource() must be of the type resource, boolean returned }
function only_accepts_resource(resource $foo) { } only_accepts_resource(fopen('php://memory', 'w'));
This RFC adds ``resource`` as reserved classname. This may collide with existing classes which are neither namespaced nor prefixed.
This is proposed for the next minor version of PHP, currently PHP 7.1.
As this is a language change, a 2/3 majority is required. The vote is a straight Yes/No vote for accepting the RFC and merging the patch.
Considered final patch: https://github.com/php/php-src/pull/1631