RE: [PHP-DEV] Re: [PHP-CVS] svn: /php/php-src/trunk/ NEWS ext/json/json.c ext/json/php_json.h ext/json/tests/serialize.phpt
| From: | Johannes Schlüter | Date: | Sat, 15 May 2010 14:47:07 +0000 |
| Subject: | RE: [PHP-DEV] Re: [PHP-CVS] svn: /php/php-src/trunk/ NEWS ext/json/json.c ext/json/php_json.h ext/json/tests/serialize.phpt | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-48300@lists.php.net to get a copy of this message | ||
Hi,
On Sat, 2010-05-15 at 15:33 +0100, Jared Williams wrote:
> With using traits, don't have to provide an implementation
> of jsonSerialize() unless want to customise the behaviour,
> but the current implementation will require having to
> implement JSONSerializable.
No. The default behavior will put the public properties from a PHP
object in the JSON object.
The interface tells the encoder not to use the default behavior but call
the methods. Your traits can only provide a default behavior not help
with the decision to be made.
johannes