Re: How to detect classes with a count_elements handler in userland?

From: Date: Mon, 14 Nov 2016 13:22:46 +0000
Subject: Re: How to detect classes with a count_elements handler in userland?
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-96885@lists.php.net to get a copy of this message
On 13.11.2016 at 22:10, Craig Duncan wrote: >> How about just making those classes implement the interface instead? > > Christoph pointed out that there may be classes in extensions that use > count_elements. Furthermore, letting those classes implement Countable could break BC. > Also it would make userland code simpler: > is_countable($thing) > vs > is_array($thing) || $thing implements \Countable Good catch! Note that Craig has added is_countable() to PR #2185 (which implements the RFC). In my opinion, that is okay, but if anybody has objections, we probably need another RFC. -- Christoph M. Becker

« previous php.internals (#96885) next »