Skip to content

Commit dbd976a

Browse files
authored
Singular DateTime::[get|set]Microsecond & no tentative return type (#13486)
* Singular DateTime::[get|set]Microsecond & no tentative return type * Added missing getMicrosecond to DateTimeInterface
1 parent 8cc8eac commit dbd976a

File tree

6 files changed

+86
-85
lines changed

6 files changed

+86
-85
lines changed

NEWS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ PHP NEWS
2323

2424
- Date:
2525
. Added DateTime[Immutable]::createFromTimestamp. (Marc Bennewitz)
26-
. Added DateTime[Immutable]::[get|set]Microseconds. (Marc Bennewitz)
26+
. Added DateTime[Immutable]::[get|set]Microsecond. (Marc Bennewitz)
2727

2828
- DOM:
2929
. Added DOMNode::compareDocumentPosition(). (nielsdos)

UPGRADING

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ PHP 8.4 UPGRADE NOTES
173173
- Date:
174174
. Added static methods
175175
DateTime[Immutable]::createFromTimestamp(int|float $timestamp): static.
176-
. Added method DateTime[Immutable]::getMicroseconds(): int.
176+
. Added method DateTime[Immutable]::getMicrosecond(): int.
177177
. Added method
178-
DateTime[Immutable]::setMicroseconds(int $microseconds): static.
178+
DateTime[Immutable]::setMicrosecond(int $microsecond): static.
179179

180180
- DOM:
181181
. Added constant DOMNode::DOCUMENT_POSITION_DISCONNECTED.

ext/date/php_date.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,15 +2377,15 @@ static void update_errors_warnings(timelib_error_container **last_errors) /* {{{
23772377
*last_errors = NULL;
23782378
} /* }}} */
23792379

2380-
static void php_date_set_time_fraction(timelib_time *time, int microseconds)
2380+
static void php_date_set_time_fraction(timelib_time *time, int microsecond)
23812381
{
2382-
time->us = microseconds;
2382+
time->us = microsecond;
23832383
}
23842384

23852385
static void php_date_get_current_time_with_fraction(time_t *sec, suseconds_t *usec)
23862386
{
23872387
#if HAVE_GETTIMEOFDAY
2388-
struct timeval tp = {0}; /* For setting microseconds */
2388+
struct timeval tp = {0}; /* For setting microsecond */
23892389

23902390
gettimeofday(&tp, NULL);
23912391
*sec = tp.tv_sec;
@@ -3855,7 +3855,7 @@ PHP_METHOD(DateTimeImmutable, setTimestamp)
38553855
/* }}} */
38563856

38573857
/* {{{ */
3858-
PHP_METHOD(DateTimeImmutable, setMicroseconds)
3858+
PHP_METHOD(DateTimeImmutable, setMicrosecond)
38593859
{
38603860
zval *object, new_object;
38613861
php_date_obj *dateobj, *new_dateobj;
@@ -3889,7 +3889,7 @@ PHP_METHOD(DateTimeImmutable, setMicroseconds)
38893889
/* }}} */
38903890

38913891
/* {{{ */
3892-
PHP_METHOD(DateTime, setMicroseconds)
3892+
PHP_METHOD(DateTime, setMicrosecond)
38933893
{
38943894
zval *object;
38953895
php_date_obj *dateobj;
@@ -3947,7 +3947,7 @@ PHP_FUNCTION(date_timestamp_get)
39473947
}
39483948
/* }}} */
39493949

3950-
PHP_METHOD(DateTime, getMicroseconds) /* {{{ */
3950+
PHP_METHOD(DateTime, getMicrosecond) /* {{{ */
39513951
{
39523952
zval *object;
39533953
php_date_obj *dateobj;

ext/date/php_date.stub.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ public function getOffset(): int;
325325
/** @tentative-return-type */
326326
public function getTimestamp(): int;
327327

328+
public function getMicrosecond(): int;
329+
328330
/** @tentative-return-type */
329331
public function diff(DateTimeInterface $targetObject, bool $absolute = false): DateInterval;
330332

@@ -412,8 +414,7 @@ public function setTimezone(DateTimeZone $timezone): DateTime {}
412414
*/
413415
public function getOffset(): int {}
414416

415-
/** @tentative-return-type */
416-
public function getMicroseconds(): int {}
417+
public function getMicrosecond(): int {}
417418

418419
/**
419420
* @tentative-return-type
@@ -439,8 +440,7 @@ public function setISODate(int $year, int $week, int $dayOfWeek = 1): DateTime {
439440
*/
440441
public function setTimestamp(int $timestamp): DateTime {}
441442

442-
/** @tentative-return-type */
443-
public function setMicroseconds(int $microseconds): static {}
443+
public function setMicrosecond(int $microsecond): static {}
444444

445445
/**
446446
* @tentative-return-type
@@ -510,10 +510,9 @@ public function getOffset(): int {}
510510
public function getTimestamp(): int {}
511511

512512
/**
513-
* @alias DateTime::getMicroseconds
514-
* @tentative-return-type
513+
* @alias DateTime::getMicrosecond
515514
*/
516-
public function getMicroseconds(): int {}
515+
public function getMicrosecond(): int {}
517516

518517
/**
519518
* @tentative-return-type
@@ -545,8 +544,7 @@ public function setISODate(int $year, int $week, int $dayOfWeek = 1): DateTimeIm
545544
/** @tentative-return-type */
546545
public function setTimestamp(int $timestamp): DateTimeImmutable {}
547546

548-
/** @tentative-return-type */
549-
public function setMicroseconds(int $microseconds): static {}
547+
public function setMicrosecond(int $microsecond): static {}
550548

551549
/** @tentative-return-type */
552550
public static function createFromMutable(DateTime $object): static {}

ext/date/php_date_arginfo.h

Lines changed: 16 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)