Re: [PHP-DEV] Re: What about a magic __toArray() method?

2020-02-03 Thread Andreas Heigl
Hey all. Instead of adding more magic I personally like the approach of explicitness more and your suggest adding an interface "Arrayable" (naming is hard and this might not be the best name) instead. Whether that interface then defines a `__toArray()`-method or something entirely different is

[PHP-DEV] Re: What about a magic __toArray() method?

2020-02-03 Thread Midori Koçak
Oh there is even a rfc. https://wiki.php.net/rfc/to-array What is the status of this? On Tue, 4 Feb 2020 at 08:18, Midori Koçak wrote: > Or we can deprecate __toString() method at all and detect cast events > instead. Would it make more sense? Something like this __casted(). > > P.S: I saw the

[PHP-DEV] Re: What about a magic __toArray() method?

2020-02-03 Thread Midori Koçak
Or we can deprecate __toString() method at all and detect cast events instead. Would it make more sense? Something like this __casted(). P.S: I saw the previous conversation but hence now we have types, it would make sense. Midori On Tue, 4 Feb 2020 at 08:15, Midori Koçak wrote: > As you know