As there is a \JsonSerializable
interface with a jsonSerialize
method, why there isn't the opposite \jsonUnserializable
interface with jsonUnserialize
method?
Is there any OFFICIAL reason about this? Some OFFICIAL debates taken somewhere? Some OFFICIAL notes?
It seems at first hand logical to add also a \JsonUnserializable
interface, so I'm asking myself why it doesn't exist. I'm very curious!
From PHP wiki
PHP RFC: JsonSerializable New Interface method Proposal :
Due to discussions, it seems the best way to implement this method is with a new function.
$user = json_decode_to_class($json, User::class);
More information here :
The complete discussion can be found here :