Skip to content

Commit 76ddff9

Browse files
committed
Nits
1 parent 946f49e commit 76ddff9

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

ext/intl/calendar/calendar_methods.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,9 @@ static void _php_intlcal_before_after(
347347
CALENDAR_METHOD_FETCH_OBJECT;
348348

349349
when_co = Z_INTL_CALENDAR_P(when_object);
350-
/* Can this ever happen ? */
351350
if (when_co->ucal == NULL) {
352-
intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR,
353-
"intlcal_before/after: Other IntlCalendar was unconstructed", 0);
354-
RETURN_FALSE;
351+
zend_argument_error(NULL, 2, "object is not fully initialized");
352+
RETURN_THROWS();
355353
}
356354

357355
UBool res = (co->ucal->*func)(*when_co->ucal, CALENDAR_ERROR_CODE(co));
@@ -716,11 +714,9 @@ U_CFUNC PHP_FUNCTION(intlcal_is_equivalent_to)
716714
}
717715

718716
other_co = Z_INTL_CALENDAR_P(other_object);
719-
// Can this happen?
720717
if (other_co->ucal == NULL) {
721-
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_is_equivalent_to:"
722-
" Other IntlCalendar is unconstructed", 0);
723-
RETURN_FALSE;
718+
zend_argument_error(NULL, 2, "object is not fully initialized");
719+
RETURN_THROWS();
724720
}
725721

726722
CALENDAR_METHOD_FETCH_OBJECT;
@@ -856,11 +852,9 @@ U_CFUNC PHP_FUNCTION(intlcal_equals)
856852

857853
CALENDAR_METHOD_FETCH_OBJECT;
858854
other_co = Z_INTL_CALENDAR_P(other_object);
859-
// Can this happen?
860855
if (other_co->ucal == NULL) {
861-
intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR,
862-
"intlcal_equals: The second IntlCalendar is unconstructed", 0);
863-
RETURN_FALSE;
856+
zend_argument_error(NULL, 2, "object is not fully initialized");
857+
RETURN_THROWS();
864858
}
865859

866860
UBool result = co->ucal->equals(*other_co->ucal, CALENDAR_ERROR_CODE(co));
@@ -1085,6 +1079,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time)
10851079
object_init_ex(return_value, php_date_get_date_ce());
10861080
zend_call_known_instance_method_with_2_params(
10871081
Z_OBJCE_P(return_value)->constructor, Z_OBJ_P(return_value), NULL, &ts_zval, timezone_zval);
1082+
// TODO Bubble up exception?
10881083
if (EG(exception)) {
10891084
intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR,
10901085
"intlcal_to_date_time: DateTime constructor has thrown exception",

ext/intl/calendar/gregoriancalendar_methods.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static void _php_intlgregcal_constructor_body(
125125
// From date/time (3, 5 or 6 arguments)
126126
for (int i = 0; i < variant; i++) {
127127
if (largs[i] < INT32_MIN || largs[i] > INT32_MAX) {
128-
zend_argument_value_error(getThis() ? (i-1):i,
128+
zend_argument_value_error(getThis() ? (i-1) : i,
129129
"must be between %d and %d", INT32_MIN, INT32_MAX);
130130
RETURN_THROWS();
131131
}
@@ -240,7 +240,7 @@ U_CFUNC PHP_FUNCTION(intlgregcal_is_leap_year)
240240
}
241241

242242
if (year < INT32_MIN || year > INT32_MAX) {
243-
zend_argument_value_error(getThis() ? 1:2, "must be between %d and %d", INT32_MIN, INT32_MAX);
243+
zend_argument_value_error(getThis() ? 1 : 2, "must be between %d and %d", INT32_MIN, INT32_MAX);
244244
RETURN_THROWS();
245245
}
246246

0 commit comments

Comments
 (0)