> 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."
I can see how easing adoption would be logical, but honestly I don't think this will help. Just because the outward API *looks* the same, a DateTimeImmutable is NOT a drop in replacement for DateTime. I honestly think that having one or the other inheriting from the other isn't *just* an LSP violation: it's a really big one. It's so big I don't think there's much worth of having them inherit; I dare say it would hurt it. > 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. Exactly. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php