Re: Questions regarding DateTimeImmutable

From: Date: Sat, 16 Feb 2013 00:25:12 +0000
Subject: Re: Questions regarding DateTimeImmutable
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-65886@lists.php.net to get a copy of this message
I think it was done to ease adoption even though it was known to violate LSP. To quote Stas, "As for established practice, everybody expects DateTime, so IMHO we should leave DateTime as base class even though it's not strictly OO-pure." This way does let users sub in DateTimeImmutable more easily and patch over a ton of unintended -- maybe not even fully noted or understood -- defects in their apps? I dunno. I looked at the first discussion from late 2010 after Benjamin E. sketched out the language addition and Larry G. suggested making them siblings as opposed to subclassing, but those discussions seemed to peter out and by the time Derick wrote the patch, the class model was kind of accepted. The discussion from 2012 is rather mild considering some pretty disparate viewpoints are represented, viz. users don't care about mutability vs. users have been coding as if DT were immutable. -- Sandy

« previous php.internals (#65886) next »