Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114130 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 13715 invoked from network); 24 Apr 2021 16:50:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Apr 2021 16:50:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EBC9D1804CC for ; Sat, 24 Apr 2021 09:54:22 -0700 (PDT) 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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 24 Apr 2021 09:54:21 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8E5795C0049 for ; Sat, 24 Apr 2021 12:54:21 -0400 (EDT) Received: from imap8 ([10.202.2.58]) by compute4.internal (MEProxy); Sat, 24 Apr 2021 12:54:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=PZANRn 1CDjy2I1+GBW+/ofouJN63M4lwg+zWNXVxKwY=; b=MtEOrCLf8espyUEUIzD70d VQ1bKdCBxSBIB02mA8p5HkbYy2ZvzLznY6G3GowqOlzp05knySrPXPF716pktqxc tH91ODIZqhq+AQLHDM+1bNmMN+K6/mWca1iBwaMQVrkT4URWSVkAoMBWtGPdCKag EQZPnlXNE8xcjt9TM04ybHrHSsR8JmtuDhY87X8EUmKLtoQsi7I1XazOI2Donya7 yYPmaLpVw9QIuJ7OFOhDDnXjBM3nHGfxhJH9lQzOzXeIewuDME46hY3CCbCRFMye duwQh2xPJ3OIrzGoLu8dMpL0KbUIgIFtF545NaP7rRHYQI0IppjNFDHVd7g63jew == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddugedguddtkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepieduteegteekgeeigeelgeegtedvieffhffhfefg fffhuefhtdehleejhefhgfefnecuffhomhgrihhnpehphhhprdhnvghtpdgvgihtvghrnh grlhhsrdhiohdpghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfr rghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 34AD63A05A1; Sat, 24 Apr 2021 12:54:21 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-403-gbc3c488b23-fm-20210419.005-gbc3c488b Mime-Version: 1.0 Message-ID: In-Reply-To: <254589645.2058488.1619277132719.JavaMail.zimbra@dafert.at> References: <254589645.2058488.1619277132719.JavaMail.zimbra@dafert.at> Date: Sat, 24 Apr 2021 11:54:01 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] Add IntlDateTimePatternGenerator From: larry@garfieldtech.com ("Larry Garfield") On Sat, Apr 24, 2021, at 10:12 AM, Mel Dafert wrote: > Hi Internals, > > I would like to propose an RFC > https://wiki.php.net/rfc/intldatetimepatterngenerator to add > IntlDateTimePatternGenerator > which exposes ICU's ability to flexibly create localized date/time > formatting patterns from a skeleton. > > Previous discussion: https://externals.io/message/113831 > Implementation: https://github.com/php/php-src/pull/6771 > > Proposed signature: > ``` > class IntlDateTimePatternGenerator > { > public function __construct(?string $locale = null) {} > > public static function create(?string $locale = null): > ?IntlDateTimePatternGenerator {} > > public function getBestPattern(string $skeleton): string|false {} > } > ``` > > There is an open question about what this should be named > `IntlDatePatternGenerator` instead, both for brevity and to keep > consistency > with `IntlDateFormatter`. (Note that the underlying ICU classes are > called `DateTimePatternGenerator` and `DateFormatter`, respectively.) > I am open to switching to the shorter form. > > Another open question is the signature, as currently both `__construct` > and `create` are exposed (like `IntlDateFormatter`). > Other classes inside the intl extension (like `IntlCalendar`) only > provide a static `create` method, and leave the `__construct` method > private. Is there a preferred way, or are both equivalent? For both points, I'd say "consistency wins by default." So if the other classes in that package already skip "Time" and use ::create() instead of a constructor, you should do the same as well unless there's a very good reason not to. (Consistency with everything else in PHP that's not that package is a possible reason not to, I grant, hence why it's somewhat subjective.) --Larry Garfield