Commit 8b005d47025 for php.net

commit 8b005d47025e4c54aed27f4ff6374bed7ca0206f
Author: Arshid <arshidkv12@gmail.com>
Date:   Fri Sep 18 02:14:04 2026 +0530

    ext/date: Change return type to static (#23317)

diff --git a/UPGRADING b/UPGRADING
index 2d1ecc64166..835e4886887 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -616,6 +616,23 @@ PHP 8.6 UPGRADE NOTES
     * SplFileObject::getCsvControl()
     RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_splfileobject_csv_methods

+- 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()
+
 - Standard:
   . metaphone() is deprecated.
     Please use a userland phonetic matching library instead.
diff --git a/ext/date/php_date.stub.php b/ext/date/php_date.stub.php
index da2182dfb6f..5ea2bb1bc5e 100644
--- a/ext/date/php_date.stub.php
+++ b/ext/date/php_date.stub.php
@@ -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
@@ -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
@@ -517,35 +517,35 @@ 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 {}
@@ -553,8 +553,8 @@ 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
@@ -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
@@ -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
@@ -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 {}
 }
diff --git a/ext/date/php_date_arginfo.h b/ext/date/php_date_arginfo.h
index ce72ee903d9..7dc1061446c 100644
Binary files a/ext/date/php_date_arginfo.h and b/ext/date/php_date_arginfo.h differ