Re: Re: Resource typehint and return type
| From: | Stanislav Malyshev | Date: | Fri, 13 Nov 2015 03:30:45 +0000 |
| Subject: | Re: Re: Resource typehint and return type | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-89200@lists.php.net to get a copy of this message | ||
Hi!
> The reason for this is that the resource type is an anachronism from an
> age in which PHP did not have objects, yet still needed to make certain
> types of data opaque. The resource type is a type that exists only to
I think more specific reason is not that resource type is outdated, but
that resource is not really a type - it's a collection of types. Mysql
connection is a resource, and file is a resource, but they are certainly
not interchangeable. So typing a value as "resource" would not achieve
you much.
--
Stas Malyshev
smalyshev@gmail.com