rfc:intldatetimepatterngenerator
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
rfc:intldatetimepatterngenerator [2021/04/24 14:58] – created deltragon | rfc:intldatetimepatterngenerator [2021/05/28 14:14] – Set status to accepted deltragon | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== PHP RFC: Add IntlDateTimePatternGenerator | + | ====== PHP RFC: Add IntlDatePatternGenerator |
* Version: 1.0 | * Version: 1.0 | ||
* Date: 2021-04-24 | * Date: 2021-04-24 | ||
* Author: Mel Dafert, mel@dafert.at | * Author: Mel Dafert, mel@dafert.at | ||
- | * Status: | + | * Status: |
* Implementation: | * Implementation: | ||
* First Published at: http:// | * First Published at: http:// | ||
+ | * Target Version: PHP 8.1 | ||
===== Introduction ===== | ===== Introduction ===== | ||
Line 21: | Line 22: | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | Add a class '' | + | Add a class '' |
<code php> | <code php> | ||
- | class IntlDateTimePatternGenerator | + | class IntlDatePatternGenerator |
{ | { | ||
public function __construct(? | public function __construct(? | ||
- | public static function create(? | + | public static function create(? |
public function getBestPattern(string $skeleton): string|false {} | public function getBestPattern(string $skeleton): string|false {} | ||
} | } | ||
+ | |||
+ | // Procedural style: | ||
+ | function datepatterngenerator_create(? | ||
+ | |||
+ | function datepatterngenerator_get_best_pattern(IntlDatePatternGenerator $patternGenerator, | ||
</ | </ | ||
Line 41: | Line 47: | ||
$today = \DateTimeImmutable:: | $today = \DateTimeImmutable:: | ||
- | $dtpg = new \IntlDateTimePatternGenerator(" | + | $dtpg = new \IntlDatePatternGenerator(" |
$pattern = $dtpg-> | $pattern = $dtpg-> | ||
echo "de: ", \IntlDateFormatter:: | echo "de: ", \IntlDateFormatter:: | ||
- | $dtpg = new \IntlDateTimePatternGenerator(" | + | $dtpg = new \IntlDatePatternGenerator(" |
$pattern = $dtpg-> | $pattern = $dtpg-> | ||
echo "en: ", \IntlDateFormatter:: | echo "en: ", \IntlDateFormatter:: | ||
Line 54: | Line 60: | ||
*/ | */ | ||
</ | </ | ||
+ | |||
+ | ==== Naming ==== | ||
+ | We have two options for naming here: | ||
+ | |||
+ | '' | ||
+ | * This would be consistent with ICU's '' | ||
+ | * 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. | ||
+ | |||
+ | '' | ||
+ | * This is both shorter and would make it more consistent with '' | ||
+ | * Since this class will be documented for PHP separately, there is not much gained from consistency with ICU, especially since we do not implement all of ICU's methods. | ||
+ | * Searchability does not appear to be an issue, as searching for 'ICU DatePatternGenerator' | ||
+ | * HHVM/Hack also chose this name: https:// | ||
+ | |||
+ | '' | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | None, except that the class name '' | + | None, except that the class name '' |
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
8.1 | 8.1 | ||
- | |||
- | ===== Open Issues ===== | ||
- | ==== Naming ==== | ||
- | The name '' | ||
- | |||
- | ==== Constructor ==== | ||
- | Like '' | ||
- | Other classes inside the intl extension (like '' | ||
===== Future Scope ===== | ===== Future Scope ===== | ||
The ICU '' | The ICU '' | ||
- | ===== Proposed Voting Choices | + | ===== Vote ===== |
- | Yes/No, requiring a 2/3 majority. | + | Yes/No, requiring a 2/3 majority. |
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== |
rfc/intldatetimepatterngenerator.txt · Last modified: 2021/06/10 11:48 by nikic