Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,23 @@ PHP 8.6 UPGRADE NOTES
directive when $details is true. It holds the built-in default value of the
directive (or null if it has none), independent of values set in php.ini,
on the command line, or at runtime.

- Date:
. The following DateTime, DateTimeImmutable, DateTimeZone, DateInterval, and DatePeriod methods now have tentative static return types:
DateTime::createFromInterface()
DateTimeImmutable::__set_state()
DateTimeImmutable::modify()
DateTimeImmutable::add()
DateTimeImmutable::sub()
DateTimeImmutable::setTimezone()
DateTimeImmutable::setTime()
DateTimeImmutable::setDate()
DateTimeImmutable::setISODate()
DateTimeImmutable::setTimestamp()
DateTimeImmutable::createFromInterface()
DateTimeZone::__set_state()
DateInterval::__set_state()
DatePeriod::__set_state()

========================================
6. New Functions
Expand Down
32 changes: 16 additions & 16 deletions ext/date/php_date.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ public static function __set_state(array $array): DateTime {}
/** @tentative-return-type */
public static function createFromImmutable(DateTimeImmutable $object): static {}

/** @return static */
public static function createFromInterface(DateTimeInterface $object): DateTime {} // TODO return type should be static
/** @tentative-return-type */
public static function createFromInterface(DateTimeInterface $object): static {}

/**
* @tentative-return-type
Expand Down Expand Up @@ -462,7 +462,7 @@ public function __unserialize(array $data): void {}
public function __wakeup(): void {}

/** @tentative-return-type */
public static function __set_state(array $array): DateTimeImmutable {}
public static function __set_state(array $array): static {}

/**
* @tentative-return-type
Expand Down Expand Up @@ -517,44 +517,44 @@ public function diff(DateTimeInterface $targetObject, bool $absolute = false): D

/** @tentative-return-type */
#[\NoDiscard(message: "as DateTimeImmutable::modify() does not modify the object itself")]
public function modify(string $modifier): DateTimeImmutable {}
public function modify(string $modifier): static {}

/** @tentative-return-type */
#[\NoDiscard(message: "as DateTimeImmutable::add() does not modify the object itself")]
public function add(DateInterval $interval): DateTimeImmutable {}
public function add(DateInterval $interval): static {}

/** @tentative-return-type */
#[\NoDiscard(message: "as DateTimeImmutable::sub() does not modify the object itself")]
public function sub(DateInterval $interval): DateTimeImmutable {}
public function sub(DateInterval $interval): static {}

/** @tentative-return-type */
#[\NoDiscard(message: "as DateTimeImmutable::setTimezone() does not modify the object itself")]
public function setTimezone(DateTimeZone $timezone): DateTimeImmutable {}
public function setTimezone(DateTimeZone $timezone): static {}

/** @tentative-return-type */
#[\NoDiscard(message: "as DateTimeImmutable::setTime() does not modify the object itself")]
public function setTime(int $hour, int $minute, int $second = 0, int $microsecond = 0): DateTimeImmutable {}
public function setTime(int $hour, int $minute, int $second = 0, int $microsecond = 0): static {}

/** @tentative-return-type */
#[\NoDiscard(message: "as DateTimeImmutable::setDate() does not modify the object itself")]
public function setDate(int $year, int $month, int $day): DateTimeImmutable {}
public function setDate(int $year, int $month, int $day): static {}

/** @tentative-return-type */
#[\NoDiscard(message: "as DateTimeImmutable::setISODate() does not modify the object itself")]
public function setISODate(int $year, int $week, int $dayOfWeek = 1): DateTimeImmutable {}
public function setISODate(int $year, int $week, int $dayOfWeek = 1): static {}

/** @tentative-return-type */
#[\NoDiscard(message: "as DateTimeImmutable::setTimestamp() does not modify the object itself")]
public function setTimestamp(int $timestamp): DateTimeImmutable {}
public function setTimestamp(int $timestamp): static {}

#[\NoDiscard(message: "as DateTimeImmutable::setMicrosecond() does not modify the object itself")]
public function setMicrosecond(int $microsecond): static {}

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

/** @return static */
public static function createFromInterface(DateTimeInterface $object): DateTimeImmutable {} // TODO return type should be static
/** @tentative-return-type */
public static function createFromInterface(DateTimeInterface $object): static {}
}

class DateTimeZone
Expand Down Expand Up @@ -639,7 +639,7 @@ public function __unserialize(array $data): void {}
public function __wakeup(): void {}

/** @tentative-return-type */
public static function __set_state(array $array): DateTimeZone {}
public static function __set_state(array $array): static {}
}

class DateInterval
Expand All @@ -666,7 +666,7 @@ public function __unserialize(array $data): void;
public function __wakeup(): void {}

/** @tentative-return-type */
public static function __set_state(array $array): DateInterval {}
public static function __set_state(array $array): static {}
}

class DatePeriod implements IteratorAggregate
Expand Down Expand Up @@ -743,7 +743,7 @@ public function __unserialize(array $data): void;
public function __wakeup(): void {}

/** @tentative-return-type */
public static function __set_state(array $array): DatePeriod {}
public static function __set_state(array $array): static {}

public function getIterator(): Iterator {}
}
Expand Down
36 changes: 14 additions & 22 deletions ext/date/php_date_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading