Skip to content

Commit 05f307a

Browse files
author
Mel Dafert
committed
IntlDatePatternGenerator: remove legacy procedural API
1 parent 7450745 commit 05f307a

6 files changed

+8
-34
lines changed

ext/intl/dateformat/datepatterngenerator.stub.php

-6
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ class IntlDatePatternGenerator
66
{
77
public function __construct(?string $locale = null) {}
88

9-
/**
10-
* @alias datepatterngenerator_create
11-
*/
129
public static function create(?string $locale = null): ?IntlDatePatternGenerator {}
1310

14-
/**
15-
* @alias datepatterngenerator_get_best_pattern
16-
*/
1711
public function getBestPattern(string $skeleton): string|false {}
1812
}

ext/intl/dateformat/datepatterngenerator_arginfo.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 04893f966115e4ec08650e04e18cb4ff9f80a842 */
2+
* Stub hash: 74026c524046787844da9f8132029735243176c6 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDatePatternGenerator___construct, 0, 0, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, locale, IS_STRING, 1, "null")
@@ -15,14 +15,14 @@ ZEND_END_ARG_INFO()
1515

1616

1717
ZEND_METHOD(IntlDatePatternGenerator, __construct);
18-
ZEND_FUNCTION(datepatterngenerator_create);
19-
ZEND_FUNCTION(datepatterngenerator_get_best_pattern);
18+
ZEND_METHOD(IntlDatePatternGenerator, create);
19+
ZEND_METHOD(IntlDatePatternGenerator, getBestPattern);
2020

2121

2222
static const zend_function_entry class_IntlDatePatternGenerator_methods[] = {
2323
ZEND_ME(IntlDatePatternGenerator, __construct, arginfo_class_IntlDatePatternGenerator___construct, ZEND_ACC_PUBLIC)
24-
ZEND_ME_MAPPING(create, datepatterngenerator_create, arginfo_class_IntlDatePatternGenerator_create, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
25-
ZEND_ME_MAPPING(getBestPattern, datepatterngenerator_get_best_pattern, arginfo_class_IntlDatePatternGenerator_getBestPattern, ZEND_ACC_PUBLIC)
24+
ZEND_ME(IntlDatePatternGenerator, create, arginfo_class_IntlDatePatternGenerator_create, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
25+
ZEND_ME(IntlDatePatternGenerator, getBestPattern, arginfo_class_IntlDatePatternGenerator_getBestPattern, ZEND_ACC_PUBLIC)
2626
ZEND_FE_END
2727
};
2828

ext/intl/dateformat/datepatterngenerator_methods.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static zend_result dtpg_ctor(INTERNAL_FUNCTION_PARAMETERS)
7474
return U_FAILURE(intl_error_get_code(NULL)) ? FAILURE : SUCCESS;
7575
}
7676

77-
U_CFUNC PHP_FUNCTION( datepatterngenerator_create )
77+
U_CFUNC PHP_METHOD( IntlDatePatternGenerator, create )
7878
{
7979
object_init_ex( return_value, IntlDatePatternGenerator_ce_ptr );
8080
if (dtpg_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
@@ -102,7 +102,7 @@ U_CFUNC PHP_METHOD( IntlDatePatternGenerator, __construct )
102102
}
103103

104104

105-
U_CFUNC PHP_FUNCTION(datepatterngenerator_get_best_pattern)
105+
U_CFUNC PHP_METHOD( IntlDatePatternGenerator, getBestPattern )
106106
{
107107
char *skeleton_str = NULL;
108108
size_t skeleton_len;

ext/intl/php_intl.stub.php

-4
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,6 @@ function datefmt_get_error_code(IntlDateFormatter $formatter): int {}
213213

214214
function datefmt_get_error_message(IntlDateFormatter $formatter): string {}
215215

216-
function datepatterngenerator_create(?string $locale = null): ?IntlDatePatternGenerator {}
217-
218-
function datepatterngenerator_get_best_pattern(IntlDatePatternGenerator $patternGenerator, string $skeleton): string|false {}
219-
220216
/* formatter */
221217

222218
function numfmt_create(string $locale, int $style, ?string $pattern = null): ?NumberFormatter {}

ext/intl/php_intl_arginfo.h

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 770f8e5a0df2f52b217af7d1145cb799a9bf0187 */
2+
* Stub hash: 0d3e65fea1fbb8f38c3268b4048cb91972a94a1b */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1)
55
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null")
@@ -367,15 +367,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_get_error_message, 0, 1,
367367
ZEND_ARG_OBJ_INFO(0, formatter, IntlDateFormatter, 0)
368368
ZEND_END_ARG_INFO()
369369

370-
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_datepatterngenerator_create, 0, 0, IntlDatePatternGenerator, 1)
371-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, locale, IS_STRING, 1, "null")
372-
ZEND_END_ARG_INFO()
373-
374-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datepatterngenerator_get_best_pattern, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
375-
ZEND_ARG_OBJ_INFO(0, patternGenerator, IntlDatePatternGenerator, 0)
376-
ZEND_ARG_TYPE_INFO(0, skeleton, IS_STRING, 0)
377-
ZEND_END_ARG_INFO()
378-
379370
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_numfmt_create, 0, 2, NumberFormatter, 1)
380371
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
381372
ZEND_ARG_TYPE_INFO(0, style, IS_LONG, 0)
@@ -881,8 +872,6 @@ ZEND_FUNCTION(datefmt_parse);
881872
ZEND_FUNCTION(datefmt_localtime);
882873
ZEND_FUNCTION(datefmt_get_error_code);
883874
ZEND_FUNCTION(datefmt_get_error_message);
884-
ZEND_FUNCTION(datepatterngenerator_create);
885-
ZEND_FUNCTION(datepatterngenerator_get_best_pattern);
886875
ZEND_FUNCTION(numfmt_create);
887876
ZEND_FUNCTION(numfmt_format);
888877
ZEND_FUNCTION(numfmt_parse);
@@ -1073,8 +1062,6 @@ static const zend_function_entry ext_functions[] = {
10731062
ZEND_FE(datefmt_localtime, arginfo_datefmt_localtime)
10741063
ZEND_FE(datefmt_get_error_code, arginfo_datefmt_get_error_code)
10751064
ZEND_FE(datefmt_get_error_message, arginfo_datefmt_get_error_message)
1076-
ZEND_FE(datepatterngenerator_create, arginfo_datepatterngenerator_create)
1077-
ZEND_FE(datepatterngenerator_get_best_pattern, arginfo_datepatterngenerator_get_best_pattern)
10781065
ZEND_FE(numfmt_create, arginfo_numfmt_create)
10791066
ZEND_FE(numfmt_format, arginfo_numfmt_format)
10801067
ZEND_FE(numfmt_parse, arginfo_numfmt_parse)

ext/intl/tests/datepatterngenerator_get_best_pattern.phpt

-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ echo $dtpg4->getBestPattern("YYYYMMMdd"), "\n";
2121

2222
echo $dtpg->getBestPattern(""), "\n";
2323

24-
echo datepatterngenerator_get_best_pattern(datepatterngenerator_create(), "YYYYMMMdd"), "\n";
25-
2624
try {
2725
$dtpg->getBestPattern();
2826
} catch(\ArgumentCountError $e) {
@@ -36,5 +34,4 @@ HH:mm
3634
MMM dd, YYYY
3735
dd. MMM YYYY
3836

39-
MMM dd, YYYY
4037
IntlDatePatternGenerator::getBestPattern() expects exactly 1 argument, 0 given

0 commit comments

Comments
 (0)