Re: Proposal: ArraySerializable interface
| From: | chobie | Date: | Wed, 11 Dec 2013 15:39:34 +0000 |
| Subject: | Re: Proposal: ArraySerializable interface | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70593@lists.php.net to get a copy of this message | ||
> I have no problems with the proposal in general, however did you see there
> is an RFC already related to this
> (https://wiki.php.net/rfc/object_cast_to_types) that has a patch you might
> like to reference?
Ah, I'm sorry. I didn't read the rfc and discussions when I sent email.
that rfc and patch seems fine. but little bit big changes.
> Not sure if this should come with an interface, for example __toString()
> does not come with a StringSerializable interface.
>
> Perhaps __toArray() / __toString / __toWhatever should all be available
> without an interface, but also have interfaces that wrap them for the sake
> of typehinting (which means adding an interface for __toString)
I agree your opinion. casting magic method shouldn't have interface.
At this time. I referenced JsonSerialize but it's too much in this case.