Re: [RFC] is_countable
| From: | Levi Morrison | Date: | Mon, 22 Jan 2018 17:15:59 +0000 |
| Subject: | Re: [RFC] is_countable | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-101657@lists.php.net to get a copy of this message | ||
On Mon, Jan 22, 2018 at 5:34 AM, Johannes Schlüter
<johannes@schlueters.de> wrote:
> Hi,
>
> On So, 2018-01-21 at 18:01 +0000, Gabriel Caruso wrote:
>> After that, I like to propose and discuss a new function for PHP 7.x
>> (current 7.3): is_countable.
>>
>> *RFC*: https://wiki.php.net/rfc/is-countable.
>
> The primary place for this imo should be reflection.
You did not provide any justification. As you do so keep in mind a lot
of code is going to look like:
if (is_countable($arg)) {
/* take a different code path, such as pre-allocating storage */
}
This is not an easily reflectable thing because it's based on an
argument which may not even be an object type. Additionally we have a
well-established convention of
is_* function for types specifically
known to the engine as is the case here.