Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113342 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 29051 invoked from network); 3 Mar 2021 13:10:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Mar 2021 13:10:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8A27918050B for ; Wed, 3 Mar 2021 05:01:25 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from hos111.unaxus.net (hos111.unaxus.net [195.191.240.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 3 Mar 2021 05:01:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=heigl.org; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=iLg0kXJtKxMQp2ZY+KdBj8zvPMCChxlNqZvTOckV/Ps=; b=ryBnKMWwip20k+YnZy7V62OOBl o54XgL00AGw3NC1H6yUt28pLo7kXfXsbX05pVJTKps5TXrEYvJBKK1lCCIl2I/9HrVIkkovRD4Eej alFF3IaMqE9G1eWBdKfEFDU6+9qYHpqREN1MH8J/PxsSuZEeNEqIbioFy0W0GMMUCzs1JbINGU67M 1v5HK6C3Sys8a7fHrzkvJZ4rwlEF75ab0ZAXgEq1lGzA4pzxJCphKWREvoMD4nEGkhERbHwQPFfY9 oDg7QCuzxgugjsDXdc7fllHqlxVObom2kQHM3LxuLIpXNQAcCdLpSTV1Jdn5SMJR2Ci/v3s2uHgv1 +YLmduyw==; Received: from ma.bitexpert.net ([82.119.168.218]:32935 helo=[192.168.13.2]) by hos111.unaxus.net with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lHR7y-0006ID-7m for internals@lists.php.net; Wed, 03 Mar 2021 14:01:22 +0100 To: internals@lists.php.net References: <09ef54b2-a6b1-5bf5-8562-f2f436fd4d92@processus.org> <9BF1EB68-3F1F-4FBF-A87F-FADF98B09E4A@9dev.de> Message-ID: Date: Wed, 3 Mar 2021 14:01:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gEUI3KwBInxG9Xt9SDTubdSDHos9A7xwO" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hos111.unaxus.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - heigl.org X-Get-Message-Sender-Via: hos111.unaxus.net: authenticated_id: a.heigl@heigl.org X-Authenticated-Sender: hos111.unaxus.net: a.heigl@heigl.org X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] Add __toString() to DateInterval From: andreas@heigl.org (Andreas Heigl) --gEUI3KwBInxG9Xt9SDTubdSDHos9A7xwO Content-Type: multipart/mixed; boundary="zbdkNzvCScF2dl1qXOnwSJdlHTgXxRx1T"; protected-headers="v1" From: Andreas Heigl To: internals@lists.php.net Message-ID: Subject: Re: [PHP-DEV] Add __toString() to DateInterval References: <09ef54b2-a6b1-5bf5-8562-f2f436fd4d92@processus.org> <9BF1EB68-3F1F-4FBF-A87F-FADF98B09E4A@9dev.de> In-Reply-To: --zbdkNzvCScF2dl1qXOnwSJdlHTgXxRx1T Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hey Am 03.03.21 um 13:05 schrieb Hans Henrik Bergan: > if FWIW if DateTime::__toString() was just > function __toString():string{ > return $this->format(\DateTime::RFC3339); > } >=20 > i certainly wouldn't complain. >=20 > On Wed, 3 Mar 2021 at 12:16, Bruce Weirdan wrote: >=20 >> On Wed, Mar 3, 2021 at 1:07 PM Moritz Friedrich wrote: >> >>> but I=E2=80=99m not too fond of the constant - all other built-in dat= e constants >>> translate to a string of plain format characters, which isn=E2=80=99t= possible in >>> this case >> >> >> Adding another format character (similar to %c used by >> DateTimeInterface::format()) would solve that. I'd rather see those classes as ValueObjects that should not have to take care about their external representation. And a custom Formatter that handles all the weird edge cases as a separate entity would be a much easier to maintain approach. And such a Formatter can easily be build in userland (I think I wrote one myself at one point) and so the maintenance-burden would also not be added to internals. That would also apply to the DateTimeInterval::format() method but that would mean a massive BC break so it is most likely out of the question. Nevertheless I would prefer an external library to handle all those formatting issues and treat the DateTime lib as internal ValueObjects Cheers Andreas --=20 ,,, (o o) +---------------------------------------------------------ooO-(_)-Ooo-+ | Andreas Heigl | | mailto:andreas@heigl.org N 50=C2=B022'59.5" E 08=C2=B0= 23'58" | | https://andreas.heigl.org | +---------------------------------------------------------------------+ | https://hei.gl/appointmentwithandreas | +---------------------------------------------------------------------+ --zbdkNzvCScF2dl1qXOnwSJdlHTgXxRx1T-- --gEUI3KwBInxG9Xt9SDTubdSDHos9A7xwO Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEOHo7et0VdZk8RJK34Ff+SCK3tkUFAmA/iJgACgkQ4Ff+SCK3 tkVnXg/+JSbN6fFHDBQB4vZvRcigen4LeSOr2XdxOHzL+tQ5ReVQEFcXeY0AYVWd tFYXQvjDCkFibK5mucTCg38aL+N+TKU0nbXgcTLvI7/N5XnB8xiTmrnktMLJ3/tw WQ2W7pZKjvduPUfozaVrEkFpE52TsBo86N6Le6MTvimoeIopdE3aRB/2bD8avoeh PFIP5LySKPloZwqblj6vs8Bh1MRrI0JoDL6z6zF+/HxbJiM+Cj2bd/Tc30y8PCxu 5AHp4Rom3F6bIO1Mce0oc+CVDCPhD1MOWbR8BoGX8Ha7sf/mjOTjVXt2jEfJrcy8 eVEF5GEf76x2MF70ARwygM/w6cgzaKFIU1RuuY7c+vShPXYfMD6ESfaWLXgvkkS1 V1g3ClrlIiOqVZEqhXdifZNsvW32Pzi9JKIgF7kdkWTA9d7wtTlllPSFxzk4q8SB Je1uG8zdiRW0/y6/zK/EGExriLivAc6ZyA77QR0iuFQ4kRD2feoBxlXTXzhrGFsb rHkAknz71Vw2sHQERQeAgw5Wk72aKWi0gciNpjjeUgLRQkd2NqjVXaAOirfmKT0P Q43LCfW+gKBYi2YYIzk3HCNw1wuWHCnhIOI1IcuotGuaogdDe7E+UjPpzGQwiipw hV9lau+czw3E90X8mkTZpJua1u3jcH5EwJ6UwSonTTQirnReXfo= =4U/A -----END PGP SIGNATURE----- --gEUI3KwBInxG9Xt9SDTubdSDHos9A7xwO--