Morning,

Just to chime in ... can you split the PR into the RFC, and the new thing
please.

Just another question on how we could make objects that have count_elements
(which is in object handlers) implement an interface on the class entry
(which is detached from handlers) ?

I'm sure it's doable, but it doesn't look very straight forward, some kind
of hacking in instanceof maybe ... not sure ...

Cheers
Joe

On Wed, Nov 16, 2016 at 9:02 PM, Nikita Popov <nikita....@gmail.com> wrote:

> On Mon, Nov 14, 2016 at 2:22 PM, Christoph M. Becker <cmbecke...@gmx.de>
> wrote:
>
> > 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.
> >
>
> How would this break BC?
>
> SXE even already has a count() method, and count_elements respects
> overrides of that method. Clearly SXE is supposed to implement Countable,
> it was simply forgotten.
>
> > 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.
> >
>
> This should be done as a separate change IMHO.
>
> Nikita
>

Reply via email to