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

Add ifdef for NumberFormatter::ROUND_HALFODD

According to the docs, UNUM_ROUND_HALF_ODD is only available since ICU 69.0. The build on Travis currently fails probably because it uses a lower version.
This commit is contained in:
Máté Kocsis
2024-01-20 10:15:02 +01:00
parent 31092c235d
commit 117b8dee64
3 changed files with 7 additions and 1 deletions

View File

@@ -50,8 +50,10 @@ class NumberFormatter
public const int ROUND_AWAY_FROM_ZERO = UNKNOWN;
/** @cvalue UNUM_ROUND_HALFEVEN */
public const int ROUND_HALFEVEN = UNKNOWN;
#if U_ICU_VERSION_MAJOR_NUM >= 69
/** @cvalue UNUM_ROUND_HALF_ODD */
public const int ROUND_HALFODD = UNKNOWN;
#endif
/** @cvalue UNUM_ROUND_HALFDOWN */
public const int ROUND_HALFDOWN = UNKNOWN;
/** @cvalue UNUM_ROUND_HALFUP */

View File

@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: dcd5c897c37ec1e0729736dedada2a6aac4cb673 */
* Stub hash: 3f8b9961bc62392c50e3871c88ea4d0934d62c6a */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter___construct, 0, 0, 2)
ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
@@ -243,12 +243,14 @@ static zend_class_entry *register_class_NumberFormatter(void)
zend_string *const_ROUND_HALFEVEN_name = zend_string_init_interned("ROUND_HALFEVEN", sizeof("ROUND_HALFEVEN") - 1, 1);
zend_declare_typed_class_constant(class_entry, const_ROUND_HALFEVEN_name, &const_ROUND_HALFEVEN_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
zend_string_release(const_ROUND_HALFEVEN_name);
#if U_ICU_VERSION_MAJOR_NUM >= 69
zval const_ROUND_HALFODD_value;
ZVAL_LONG(&const_ROUND_HALFODD_value, UNUM_ROUND_HALF_ODD);
zend_string *const_ROUND_HALFODD_name = zend_string_init_interned("ROUND_HALFODD", sizeof("ROUND_HALFODD") - 1, 1);
zend_declare_typed_class_constant(class_entry, const_ROUND_HALFODD_name, &const_ROUND_HALFODD_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
zend_string_release(const_ROUND_HALFODD_name);
#endif
zval const_ROUND_HALFDOWN_value;
ZVAL_LONG(&const_ROUND_HALFDOWN_value, UNUM_ROUND_HALFDOWN);

View File

@@ -2,6 +2,8 @@
NumberFormatter: rounding modes
--EXTENSIONS--
intl
--SKIPIF--
<?php if (version_compare(INTL_ICU_VERSION, '69.0') < 0) die('skip for ICU >= 69.0'); ?>
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);