Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87223 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3166 invoked from network); 21 Jul 2015 13:37:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jul 2015 13:37:32 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.53 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.53 mail-wg0-f53.google.com Received: from [74.125.82.53] ([74.125.82.53:32841] helo=mail-wg0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AD/94-03461-A1B4EA55 for ; Tue, 21 Jul 2015 09:37:31 -0400 Received: by wgmn9 with SMTP id n9so156808004wgm.0 for ; Tue, 21 Jul 2015 06:37:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=Yr274s2h7ZrpOU7n8bWvMhd+46xV+V/gmJm2zn1Heuw=; b=ul/vqdr9Z22U2v2tJIKWOHXMgTpXOuRQ6ssL8SYOZsRI6EZP2f3AirN32qX+NU3I9Q ODtSauOJgXsvZ46gpCWKRyZTitUHX2fh7FxwfdjrX3RaUUS/iS2KIST9liMkGtf1sQug 3/aXp4bjkQe32pG5eXsD0q9cnXcg3z9k547eYnrYFRNW9FPHUA46W2L3N5oXwJ3mselX JNHJ262cMVSUvvzQnGwgIuJZ8biWncExZWghXzHA4FgCUWn4KM11KNZuOxyrLx8WuEKw sgublo3F5RPPK2YtNvR+6Rc46WPn52G3u77qRtNUMSHzSYeF+OHH9FI1/IYCJd7P0nI7 e+hQ== X-Received: by 10.194.206.65 with SMTP id lm1mr67992670wjc.117.1437485847832; Tue, 21 Jul 2015 06:37:27 -0700 (PDT) Received: from [192.168.0.136] ([62.189.198.114]) by smtp.googlemail.com with ESMTPSA id y1sm16928614wib.7.2015.07.21.06.37.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Jul 2015 06:37:26 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <55AE4AE7.6000408@gmail.com> Date: Tue, 21 Jul 2015 14:36:39 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] DateTimeInterface is not a usable interface? From: rowan.collins@gmail.com (Rowan Collins) Marco Pivetta wrote on 21/07/2015 13:29: > Then make DateTime and DateTimeImmutable only interact with DateTime and > DateTimeImmutable (or child classes), but don't rely on the interface if > you're not actually respecting it internally in first place, no? What exactly are you suggesting? That DateTimeInterface shouldn't exist at all? It's useful to be able to check if a given variable is an instance of either DateTime or DateTimeImmutable, and an Interface is an obvious way to do this, regardless of what else can be done with that interface. As you can see here: http://3v4l.org/SU1Xq this was definitely a bug in early 5.5.x releases (the error is a frankly baffling "Fatal error: DateTime::diff() must be derived from DateTimeImmutable::diff"), so the change in behaviour in a point release seems justified. HHVM apparently still allows the implementation, then fatals when you try to diff against it. So, userland implementations of the interface have never worked; it might be nice to add the ability in, but in answer to the original question, yes, there's a reason behind this limitation. Regards, -- Rowan Collins [IMSoP]