1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Deprecate NumberFormater::TYPE_CURRENCY constant

This commit is contained in:
George Peter Banyard
2023-07-07 12:37:12 +01:00
parent 3e2dbbf9c2
commit d65251e6e8
4 changed files with 27 additions and 3 deletions

View File

@@ -392,6 +392,7 @@ class NumberFormatter
public const TYPE_DOUBLE = UNKNOWN;
/**
* @var int
* @deprecated
* @cvalue FORMAT_TYPE_CURRENCY
*/
public const TYPE_CURRENCY = UNKNOWN;

View File

@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: de64db0e66d2113dd10c556cd61324a7a7952973 */
* Stub hash: 3b050eaf6f2f54e3726b04a17d40b06ad610a724 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter___construct, 0, 0, 2)
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
@@ -571,7 +571,7 @@ static zend_class_entry *register_class_NumberFormatter(void)
zval const_TYPE_CURRENCY_value;
ZVAL_LONG(&const_TYPE_CURRENCY_value, FORMAT_TYPE_CURRENCY);
zend_string *const_TYPE_CURRENCY_name = zend_string_init_interned("TYPE_CURRENCY", sizeof("TYPE_CURRENCY") - 1, 1);
zend_declare_class_constant_ex(class_entry, const_TYPE_CURRENCY_name, &const_TYPE_CURRENCY_value, ZEND_ACC_PUBLIC, NULL);
zend_declare_class_constant_ex(class_entry, const_TYPE_CURRENCY_name, &const_TYPE_CURRENCY_value, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL);
zend_string_release(const_TYPE_CURRENCY_name);
return class_entry;

View File

@@ -0,0 +1,15 @@
--TEST--
NumberFormatter::TYPE_CURRENCY is deprecated
--EXTENSIONS--
intl
--FILE--
<?php
var_dump(NumberFormatter::TYPE_CURRENCY);
var_dump(constant('NumberFormatter::TYPE_CURRENCY'));
?>
--EXPECTF--
Deprecated: Constant NumberFormatter::TYPE_CURRENCY is deprecated in %s on line %d
int(4)
Deprecated: Constant NumberFormatter::TYPE_CURRENCY is deprecated in %s on line %d
int(4)

View File

@@ -54,12 +54,20 @@ try {
}
?>
--EXPECT--
--EXPECTF--
numfmt_format(): Argument #3 ($type) must be a NumberFormatter::TYPE_* constant
NumberFormatter::format(): Argument #2 ($type) must be a NumberFormatter::TYPE_* constant
numfmt_parse(): Argument #3 ($type) must be a NumberFormatter::TYPE_* constant
NumberFormatter::parse(): Argument #2 ($type) must be a NumberFormatter::TYPE_* constant
Deprecated: Constant NumberFormatter::TYPE_CURRENCY is deprecated in %s on line %d
numfmt_format(): Argument #3 ($type) cannot be NumberFormatter::TYPE_CURRENCY constant, use numfmt_format_currency() function instead
Deprecated: Constant NumberFormatter::TYPE_CURRENCY is deprecated in %s on line %d
NumberFormatter::format(): Argument #2 ($type) cannot be NumberFormatter::TYPE_CURRENCY constant, use NumberFormatter::formatCurrency() method instead
Deprecated: Constant NumberFormatter::TYPE_CURRENCY is deprecated in %s on line %d
numfmt_parse(): Argument #3 ($type) cannot be NumberFormatter::TYPE_CURRENCY constant, use numfmt_parse_currency() function instead
Deprecated: Constant NumberFormatter::TYPE_CURRENCY is deprecated in %s on line %d
NumberFormatter::parse(): Argument #2 ($type) cannot be NumberFormatter::TYPE_CURRENCY constant, use NumberFormatter::parseCurrency() method instead