Add static return type for DateTime*::createFrom*() when possible

Fix GH-8544
This commit is contained in:
Máté Kocsis 2022-05-13 12:13:48 +02:00
parent 37b3092820
commit 8b991b4ae4
No known key found for this signature in database
GPG Key ID: FD055E41728BF310
3 changed files with 13 additions and 13 deletions

View File

@ -19,6 +19,12 @@ PHP 8.2 UPGRADE NOTES
1. Backward Incompatible Changes
========================================
- Date:
. DateTime::createFromImmutable() now has a tentative return type of static,
previously it was DateTime
. DateTimeImmutable::createFromMutable() now has a tentative return type of static,
previously it was DateTimeImmutable
- Standard:
. strtolower() and strtoupper() are no longer locale-sensitive. They now
perform ASCII case conversion, as if the locale were "C". Use

View File

@ -225,11 +225,8 @@ class DateTime implements DateTimeInterface
/** @tentative-return-type */
public static function __set_state(array $array): DateTime {}
/**
* @tentative-return-type
* @return static
*/
public static function createFromImmutable(DateTimeImmutable $object): DateTime {} // TODO return type should be static
/** @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
@ -407,11 +404,8 @@ class DateTimeImmutable implements DateTimeInterface
/** @tentative-return-type */
public function setTimestamp(int $timestamp): DateTimeImmutable {}
/**
* @tentative-return-type
* @return static
*/
public static function createFromMutable(DateTime $object): DateTimeImmutable {} // TODO return type should be 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

View File

@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 86c6321ad1dc6f0efe94669dc6fd759752c32302 */
* Stub hash: ca149a2efec878f0730eb744f4e11f6462d70d83 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtotime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, datetime, IS_STRING, 0)
@ -266,7 +266,7 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_DateTime___set_st
ZEND_ARG_TYPE_INFO(0, array, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_DateTime_createFromImmutable, 0, 1, DateTime, 0)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_DateTime_createFromImmutable, 0, 1, IS_STATIC, 0)
ZEND_ARG_OBJ_INFO(0, object, DateTimeImmutable, 0)
ZEND_END_ARG_INFO()
@ -397,7 +397,7 @@ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_DateTimeImmutable
ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_DateTimeImmutable_createFromMutable, 0, 1, DateTimeImmutable, 0)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_DateTimeImmutable_createFromMutable, 0, 1, IS_STATIC, 0)
ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
ZEND_END_ARG_INFO()