On 23/09/2021 17:52, Nikita Popov wrote:
If we dropped
all non-deprecation changes from PHP 8.1, the upgrade would be a bit
easier, but not by much. This is not where the main cost is.
Be that as it may, the question remains whether *the particular case of
is_resource() and get_resource_type()* could be made easier.
Was the option of having a "Resource" base class or interface ever
discussed? If it had a method called something like
"getResourceTypeString()" then get_resource_type() could do (the
internal equivalent of):
if ( is_resource($arg) ) {
// current logic
}
elseif ( is_object($arg) && $arg instanceOf Resource ) {
return $arg->getResourceTypeString();
}
I suspect as 8.0 and then 8.1 gain adoption, there is going to be a lot
of confusion around the resource -> object change. Most users probably
don't really know what a "resource", they just know the boilerplate to use.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php