rfc:intldatetimepatterngenerator

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rfc:intldatetimepatterngenerator [2021/04/30 16:18]
deltragon Add not about secondary vote
rfc:intldatetimepatterngenerator [2021/06/10 11:48] (current)
nikic
Line 3: Line 3:
   * Date: 2021-04-24   * Date: 2021-04-24
   * Author: Mel Dafert, mel@dafert.at   * Author: Mel Dafert, mel@dafert.at
-  * Status: Under Discussion+  * Status: Implemented
   * Implementation: https://github.com/php/php-src/pull/6771   * Implementation: https://github.com/php/php-src/pull/6771
   * First Published at: http://wiki.php.net/rfc/intldatetimepatterngenerator   * First Published at: http://wiki.php.net/rfc/intldatetimepatterngenerator
 +  * Target Version: PHP 8.1
  
 ===== Introduction ===== ===== Introduction =====
Line 32: Line 33:
     public function getBestPattern(string $skeleton): string|false {}     public function getBestPattern(string $skeleton): string|false {}
 } }
 +
 +// Procedural style:
 +function datepatterngenerator_create(?string $locale = null): ?IntlDatePatternGenerator {}
 +
 +function datepatterngenerator_get_best_pattern(IntlDatePatternGenerator $patternGenerator, string $skeleton): string|false {}
 </code> </code>
  
Line 59: Line 65:
  
 ''IntlDateTimePatternGenerator'': ''IntlDateTimePatternGenerator'':
-  * This would be consistent with ICU's ''DateTimePatternGenerator'' (similar to how ''IntlDateFormatter'' is consistent with ICU's ''DateFormatter''.+  * This would be consistent with ICU's ''DateTimePatternGenerator'' (similar to how ''IntlDateFormatter'' is consistent with ICU's ''DateFormatter'').
   * In theory, this would also mean that people familiar with ICU would immediately know what to expect.   * In theory, this would also mean that people familiar with ICU would immediately know what to expect.
   * Users searching the web for the ICU name will find this class easier, and vice versa.   * Users searching the web for the ICU name will find this class easier, and vice versa.
Line 68: Line 74:
   * Searchability does not appear to be an issue, as searching for 'ICU DatePatternGenerator' will bring up the right results.   * Searchability does not appear to be an issue, as searching for 'ICU DatePatternGenerator' will bring up the right results.
   * HHVM/Hack also chose this name: https://docs.hhvm.com/hack/reference/class/IntlDatePatternGenerator/   * HHVM/Hack also chose this name: https://docs.hhvm.com/hack/reference/class/IntlDatePatternGenerator/
 +
 +''IntlDatePatternGenerator'' seems to be the preferred option in all counts here.
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
Line 74: Line 82:
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
 8.1 8.1
- 
-===== Open Issues ===== 
- 
-==== Constructor ==== 
-Like ''IntlDateFormatter'', this provides both a ''<nowiki>__construct</nowiki>'' method and an equivalent static ''create'' method. 
-Other classes inside the intl extension (like ''IntlCalendar'') only provide a static ''create'' method, and leave the ''<nowiki>__</nowiki>construct'' method private. Is there a preferred way, or are both equivalent? 
  
 ===== Future Scope ===== ===== Future Scope =====
 The ICU ''DateTimePatternGenerator'' class provides some additional methods (for example ''getSkeleton'' to reduce a given pattern to its skeleton form). These other methodes are of limited use compared to ''getBestPattern'', and have been omitted in this RFC. The ICU ''DateTimePatternGenerator'' class provides some additional methods (for example ''getSkeleton'' to reduce a given pattern to its skeleton form). These other methodes are of limited use compared to ''getBestPattern'', and have been omitted in this RFC.
  
-===== Proposed Voting Choices ===== +===== Vote ===== 
-Yes/No, requiring a 2/3 majority. +Yes/No, requiring a 2/3 majority. Voting started on 2021-05-14 16:00 UTC and ends 2021-05-28 16:00 UTC. 
- +<doodle title="Add IntlDatePatternGenerator?" auth="deltragon" voteType="single" closed="true"> 
-Secondary vote to decide between ''IntlDatePatternGenerator'' and ''IntlDateTimePatternGenerator'' (requires simple majority).+   * Yes 
 +   * No 
 +</doodle>
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
rfc/intldatetimepatterngenerator.1619799532.txt.gz · Last modified: 2021/04/30 16:18 by deltragon