Skip to content

Commit f66627a

Browse files
committed
Another pass of improving ext/date argument names
1 parent 2b66cc9 commit f66627a

File tree

8 files changed

+42
-35
lines changed

8 files changed

+42
-35
lines changed

Zend/tests/parameter_default_values/internal_declaration_error_class_const.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ class MyDateTimeZone extends DateTimeZone
88
{
99
}
1010
}
11+
?>
1112
--EXPECTF--
12-
Fatal error: Declaration of MyDateTimeZone::listIdentifiers() must be compatible with DateTimeZone::listIdentifiers(int $what = DateTimeZone::ALL, ?string $country = null) in %s on line %d
13+
Fatal error: Declaration of MyDateTimeZone::listIdentifiers() must be compatible with DateTimeZone::listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null) in %s on line %d

Zend/tests/parameter_default_values/internal_declaration_error_const.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ class MyDateTimeZone extends DateTimeZone
88
{
99
}
1010
}
11+
?>
1112
--EXPECTF--
12-
Fatal error: Declaration of MyDateTimeZone::getTransitions() must be compatible with DateTimeZone::getTransitions(int $timestamp_begin = PHP_INT_MIN, int $timestamp_end = PHP_INT_MAX) in %s on line %d
13+
Fatal error: Declaration of MyDateTimeZone::getTransitions() must be compatible with DateTimeZone::getTransitions(int $timestampBegin = PHP_INT_MIN, int $timestampEnd = PHP_INT_MAX) in %s on line %d

Zend/tests/parameter_default_values/internal_declaration_error_false.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ interface MyDateTimeInterface extends DateTimeInterface
77
{
88
public function diff();
99
}
10+
?>
1011
--EXPECTF--
11-
Fatal error: Declaration of MyDateTimeInterface::diff() must be compatible with DateTimeInterface::diff(DateTimeInterface $object, bool $absolute = false) in %s on line %d
12+
Fatal error: Declaration of MyDateTimeInterface::diff() must be compatible with DateTimeInterface::diff(DateTimeInterface $targetObject, bool $absolute = false) in %s on line %d

ext/date/php_date.stub.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/** @generate-function-entries */
44

5-
function strtotime(string $datetime, ?int $now = null): int|false {}
5+
function strtotime(string $datetime, ?int $baseTimestamp = null): int|false {}
66

77
function date(string $format, ?int $timestamp = null): string {}
88

@@ -62,7 +62,7 @@ function date_timezone_set(DateTimeInterface $object, DateTimeZone $timezone): D
6262
function date_offset_get(DateTimeInterface $object): int {}
6363

6464
function date_diff(
65-
DateTimeInterface $object1, DateTimeInterface $object2, bool $absolute = false): DateInterval {}
65+
DateTimeInterface $baseObject, DateTimeInterface $targetObject, bool $absolute = false): DateInterval {}
6666

6767
function date_time_set(
6868
DateTime $object, int $hour, int $minute, int $second = 0, int $microsecond = 0): DateTime {}
@@ -84,7 +84,7 @@ function timezone_name_from_abbr(string $abbr, int $gmtoffset = -1, int $isdst =
8484
function timezone_offset_get(DateTimeZone $object, DateTimeInterface $datetime): int {}
8585

8686
function timezone_transitions_get(
87-
DateTimeZone $object, int $timestamp_begin = PHP_INT_MIN, int $timestamp_end = PHP_INT_MAX): array|false {}
87+
DateTimeZone $object, int $timestampBegin = PHP_INT_MIN, int $timestampEnd = PHP_INT_MAX): array|false {}
8888

8989
function timezone_location_get(DateTimeZone $object): array|false {}
9090

@@ -98,7 +98,7 @@ function date_interval_create_from_date_string(string $datetime): DateInterval|f
9898

9999
function date_interval_format(DateInterval $object, string $format): string {}
100100

101-
function date_default_timezone_set(string $timezone_identifier): bool {}
101+
function date_default_timezone_set(string $timezoneID): bool {}
102102

103103
function date_default_timezone_get(): string {}
104104

@@ -132,7 +132,7 @@ public function getOffset();
132132
public function getTimestamp();
133133

134134
/** @return DateInterval|false */
135-
public function diff(DateTimeInterface $object, bool $absolute = false);
135+
public function diff(DateTimeInterface $targetObject, bool $absolute = false);
136136

137137
public function __wakeup();
138138
}
@@ -221,7 +221,7 @@ public function setDate(int $year, int $month, int $day) {}
221221
* @return DateTime
222222
* @alias date_isodate_set
223223
*/
224-
public function setISODate(int $year, int $week, int $day_of_week = 1) {}
224+
public function setISODate(int $year, int $week, int $dayOfWeek = 1) {}
225225

226226
/**
227227
* @return DateTime
@@ -239,7 +239,7 @@ public function getTimestamp() {}
239239
* @return DateInterval|false
240240
* @alias date_diff
241241
*/
242-
public function diff(DateTimeInterface $object, bool $absolute = false) {}
242+
public function diff(DateTimeInterface $targetObject, bool $absolute = false) {}
243243
}
244244

245245
class DateTimeImmutable implements DateTimeInterface
@@ -312,7 +312,7 @@ public function setTime(int $hour, int $minute, int $second = 0, int $microsecon
312312
public function setDate(int $year, int $month, int $day) {}
313313

314314
/** @return DateTimeImmutable */
315-
public function setISODate(int $year, int $week, int $day_of_week = 1) {}
315+
public function setISODate(int $year, int $week, int $dayOfWeek = 1) {}
316316

317317
/** @return DateTimeImmutable */
318318
public function setTimestamp(int $timestamp) {}
@@ -337,13 +337,13 @@ public function getName() {}
337337
* @return int
338338
* @alias timezone_offset_get
339339
*/
340-
public function getOffset(DateTimeInterface $datetime) {}
340+
public function getOffset(DateTimeInterface $object) {}
341341

342342
/**
343343
* @return array|false
344344
* @alias timezone_transitions_get
345345
*/
346-
public function getTransitions(int $timestamp_begin = PHP_INT_MIN, int $timestamp_end = PHP_INT_MAX) {}
346+
public function getTransitions(int $timestampBegin = PHP_INT_MIN, int $timestampEnd = PHP_INT_MAX) {}
347347

348348
/**
349349
* @return array|false
@@ -361,7 +361,7 @@ public static function listAbbreviations() {}
361361
* @return array|false
362362
* @alias timezone_identifiers_list
363363
*/
364-
public static function listIdentifiers(int $what = DateTimeZone::ALL, ?string $country = null) {}
364+
public static function listIdentifiers(int $timezoneGroup = DateTimeZone::ALL, ?string $countryCode = null) {}
365365

366366
public function __wakeup() {}
367367

@@ -371,7 +371,7 @@ public static function __set_state(array $array) {}
371371

372372
class DateInterval
373373
{
374-
public function __construct(string $interval_spec) {}
374+
public function __construct(string $duration) {}
375375

376376
/**
377377
* @return DateInterval|false

ext/date/php_date_arginfo.h

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: dbb98fcf9462d309d4276ba76cfbbe20172d2f30 */
2+
* Stub hash: 8791b7918a9d72cb4f1c1ab6703324e3c7a805c5 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtotime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(0, datetime, IS_STRING, 0)
6-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, now, IS_LONG, 1, "null")
6+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, baseTimestamp, IS_LONG, 1, "null")
77
ZEND_END_ARG_INFO()
88

99
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date, 0, 1, IS_STRING, 0)
@@ -119,8 +119,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_offset_get, 0, 1, IS_LONG,
119119
ZEND_END_ARG_INFO()
120120

121121
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_diff, 0, 2, DateInterval, 0)
122-
ZEND_ARG_OBJ_INFO(0, object1, DateTimeInterface, 0)
123-
ZEND_ARG_OBJ_INFO(0, object2, DateTimeInterface, 0)
122+
ZEND_ARG_OBJ_INFO(0, baseObject, DateTimeInterface, 0)
123+
ZEND_ARG_OBJ_INFO(0, targetObject, DateTimeInterface, 0)
124124
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, absolute, _IS_BOOL, 0, "false")
125125
ZEND_END_ARG_INFO()
126126

@@ -176,8 +176,8 @@ ZEND_END_ARG_INFO()
176176

177177
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_transitions_get, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
178178
ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0)
179-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp_begin, IS_LONG, 0, "PHP_INT_MIN")
180-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp_end, IS_LONG, 0, "PHP_INT_MAX")
179+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestampBegin, IS_LONG, 0, "PHP_INT_MIN")
180+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestampEnd, IS_LONG, 0, "PHP_INT_MAX")
181181
ZEND_END_ARG_INFO()
182182

183183
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_location_get, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
@@ -205,7 +205,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_interval_format, 0, 2, IS_S
205205
ZEND_END_ARG_INFO()
206206

207207
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_default_timezone_set, 0, 1, _IS_BOOL, 0)
208-
ZEND_ARG_TYPE_INFO(0, timezone_identifier, IS_STRING, 0)
208+
ZEND_ARG_TYPE_INFO(0, timezoneID, IS_STRING, 0)
209209
ZEND_END_ARG_INFO()
210210

211211
#define arginfo_date_default_timezone_get arginfo_timezone_version_get
@@ -239,7 +239,7 @@ ZEND_END_ARG_INFO()
239239
#define arginfo_class_DateTimeInterface_getTimestamp arginfo_class_DateTimeInterface_getTimezone
240240

241241
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeInterface_diff, 0, 0, 1)
242-
ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
242+
ZEND_ARG_OBJ_INFO(0, targetObject, DateTimeInterface, 0)
243243
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, absolute, _IS_BOOL, 0, "false")
244244
ZEND_END_ARG_INFO()
245245

@@ -308,7 +308,7 @@ ZEND_END_ARG_INFO()
308308
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setISODate, 0, 0, 2)
309309
ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
310310
ZEND_ARG_TYPE_INFO(0, week, IS_LONG, 0)
311-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, day_of_week, IS_LONG, 0, "1")
311+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, dayOfWeek, IS_LONG, 0, "1")
312312
ZEND_END_ARG_INFO()
313313

314314
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setTimestamp, 0, 0, 1)
@@ -337,7 +337,10 @@ ZEND_END_ARG_INFO()
337337

338338
#define arginfo_class_DateTimeImmutable_getTimestamp arginfo_class_DateTimeInterface_getTimezone
339339

340-
#define arginfo_class_DateTimeImmutable_diff arginfo_class_DateTimeInterface_diff
340+
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeImmutable_diff, 0, 0, 1)
341+
ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
342+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, absolute, _IS_BOOL, 0, "false")
343+
ZEND_END_ARG_INFO()
341344

342345
#define arginfo_class_DateTimeImmutable_modify arginfo_class_DateTime_modify
343346

@@ -370,29 +373,29 @@ ZEND_END_ARG_INFO()
370373
#define arginfo_class_DateTimeZone_getName arginfo_class_DateTimeInterface_getTimezone
371374

372375
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_getOffset, 0, 0, 1)
373-
ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0)
376+
ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
374377
ZEND_END_ARG_INFO()
375378

376379
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_getTransitions, 0, 0, 0)
377-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp_begin, IS_LONG, 0, "PHP_INT_MIN")
378-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp_end, IS_LONG, 0, "PHP_INT_MAX")
380+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestampBegin, IS_LONG, 0, "PHP_INT_MIN")
381+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestampEnd, IS_LONG, 0, "PHP_INT_MAX")
379382
ZEND_END_ARG_INFO()
380383

381384
#define arginfo_class_DateTimeZone_getLocation arginfo_class_DateTimeInterface_getTimezone
382385

383386
#define arginfo_class_DateTimeZone_listAbbreviations arginfo_class_DateTimeInterface_getTimezone
384387

385388
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_listIdentifiers, 0, 0, 0)
386-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, what, IS_LONG, 0, "DateTimeZone::ALL")
387-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, country, IS_STRING, 1, "null")
389+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timezoneGroup, IS_LONG, 0, "DateTimeZone::ALL")
390+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, countryCode, IS_STRING, 1, "null")
388391
ZEND_END_ARG_INFO()
389392

390393
#define arginfo_class_DateTimeZone___wakeup arginfo_class_DateTimeInterface_getTimezone
391394

392395
#define arginfo_class_DateTimeZone___set_state arginfo_class_DateTime___set_state
393396

394397
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateInterval___construct, 0, 0, 1)
395-
ZEND_ARG_TYPE_INFO(0, interval_spec, IS_STRING, 0)
398+
ZEND_ARG_TYPE_INFO(0, duration, IS_STRING, 0)
396399
ZEND_END_ARG_INFO()
397400

398401
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateInterval_createFromDateString, 0, 0, 1)

ext/date/tests/68062.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ try {
1212
} catch (TypeError $e) {
1313
echo $e->getMessage(), "\n";
1414
}
15+
?>
1516
--EXPECT--
1617
3600
17-
DateTimeZone::getOffset(): Argument #1 ($datetime) must be of type DateTimeInterface, int given
18+
DateTimeZone::getOffset(): Argument #1 ($object) must be of type DateTimeInterface, int given

ext/date/tests/bug70245.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ try {
1010
}
1111
?>
1212
--EXPECT--
13-
strtotime(): Argument #2 ($now) must be of type ?int, DateTime given
13+
strtotime(): Argument #2 ($baseTimestamp) must be of type ?int, DateTime given

ext/reflection/tests/internal_parameter_default_value/ReflectionParameter_toString_Internal.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ Parameter #1 [ <required> int $minute ]
2424
Parameter #2 [ <optional> int $second = 0 ]
2525
Parameter #3 [ <optional> int $microsecond = 0 ]
2626
----------
27-
Parameter #0 [ <optional> int $what = DateTimeZone::ALL ]
28-
Parameter #1 [ <optional> ?string $country = null ]
27+
Parameter #0 [ <optional> int $timezoneGroup = DateTimeZone::ALL ]
28+
Parameter #1 [ <optional> ?string $countryCode = null ]

0 commit comments

Comments
 (0)