Re: [RFC] is_countable
| From: | Craig Duncan | Date: | Mon, 22 Jan 2018 09:52:51 +0000 |
| Subject: | Re: [RFC] is_countable | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-101650@lists.php.net to get a copy of this message | ||
Hi Gabriel,
I proposed a similar function at the time of introducing the warning, but
it doesn't look like I got around to creating an RFC for it:
https://github.com/php/php-src/pull/2206/files
During this work we realised that objects don't have to implement the
'\Countable' interface to be successfully handled by 'count()',
internal/extension classes can implement a 'count_elements' handler and
ignore the interface.
I'd suggest that 'is_countable()' should be consistent with 'count()'.
Thanks,
Craig