Re: Add __toArray() method to objects that would be called on cast to array
| From: | Marco Pivetta | Date: | Thu, 16 Mar 2017 00:32:57 +0000 |
| Subject: | Re: Add __toArray() method to objects that would be called on cast to array | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98561@lists.php.net to get a copy of this message | ||
As just told: existing code hinting against generic
object breaks. This
is a change in semantics in an existing operator. It is just sane to
consider it a BC break, since the operator cannot be relied upon for a
certain family of problems: invent a new operator.
That's basically the path to follow anytime something could be overloaded,
but shouldn't due to BC constraints.
On 16 Mar 2017 1:22 a.m., "Andrey Andreev" <narf@devilix.net> wrote:
>
>
> On Mar 16, 2017 2:01 AM, "Marco Pivetta" <ocramius@gmail.com> wrote:
>
> What changes is the interface of the (array) operator.
>
>
> I understand what you mean, I just disagree that it constitutes a BC break
> in the sense that no existing code would break/misbehave by simply updating
> to a PHP version including the feature.
>
> That's just the only sane criteria by which to label changes as BC breaks,
> because if we don't stick to that, there'd be an argument to be made that
> literally every change is. And that would mean the term loses its meaning
> and becomes useless.
>
> Cheers,
> Andrey.
>