Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65888 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97477 invoked from network); 16 Feb 2013 08:28:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2013 08:28:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=sebastian@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sebastian@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 93.190.64.33 as permitted sender) X-PHP-List-Original-Sender: sebastian@php.net X-Host-Fingerprint: 93.190.64.33 mail-3.de-punkt.de Received: from [93.190.64.33] ([93.190.64.33:46000] helo=mail-3.de-punkt.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1F/10-29197-3234F115 for ; Sat, 16 Feb 2013 03:28:21 -0500 Received: (qmail 12228 invoked by uid 511); 16 Feb 2013 08:28:15 -0000 Received: by simscan 1.4.0 ppid: 12221, pid: 12226, t: 0.7910s scanners: attach: 1.4.0 Received: from unknown (HELO ?192.168.2.31?) (sb@sebastian-bergmann.de@93.214.180.76) by 0 with ESMTPA; 16 Feb 2013 08:28:15 -0000 Message-ID: <511F4321.4060908@php.net> Date: Sat, 16 Feb 2013 09:28:17 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: X-Enigmail-Version: 1.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Questions regarding DateTimeImmutable From: sebastian@php.net (Sebastian Bergmann) Am 15.02.2013 21:49, schrieb Nikita Popov: > a) The DateTimeImmutable class extends the DateTime class. Why was this > done this way? Both classes are incompatible (as in the inheritance > violates LSP). E.g. if you hint against DateTime, then passing in > DateTimeImmutable will not work (as the behavior is different). The same > also applies the other way around (DateTime extending DateTimeImmutable). > Imho a mutable and an immutable variant of a class can't reasonably extend > from one another, so I'm not sure why this was done. I raised the same question to Derick and he said that it had to be done this way because of BC issues. The way it is implemented right now makes no sense to me at all. Thank you, Nikita, for bringing this to the attention of this list. -- Sebastian Bergmann Co-Founder and Principal Consultant http://sebastian-bergmann.de/ http://thePHP.cc/