On 6/4/2016 11:05 PM, Rasmus Schultz wrote:
> I know that things like internal state and read-only properties are
> possible for classes written in C, but those features aren't possible in
> PHP code - classes that behave this way are inconsistent with classes
> written in the language, and it becomes a problem in cases such as this.
> 
> That is no help at all, when you're implementing a JSON serializer.
> 
> You can see the class in question here:
> 
> https://github.com/mindplay-dk/jsonfreeze/blob/master/mindplay/jsonfreeze/JsonSerializer.php
> 
> Because DateTime does not behave like other classes, the only work-around
> is to explicitly handle DateTime with an if/instanceof-statement and handle
> that particular class explicitly.
> 
> There are plenty of work-arounds - the point is that this class doesn't
> behave consistently with any other PHP class.
> 

I have to fully agree with Rasmus here. This is one of those unnecessary
WTF moments for users that forces them to implement work arounds instead
of simply writing good software.

-- 
Richard "Fleshgrinder" Fussenegger

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to