From 651ad6cb5033ba5ad63e1048c73f09984024b9b0 Mon Sep 17 00:00:00 2001 From: Bitwise Operators Date: Mon, 13 Jun 2022 10:00:38 +0200 Subject: [PATCH] release:fix: Change return type of createFromInterface() methods on DateTime and DateTimeImmutable to 'static' so extending classes are recognized. --- dictionaries/CallMap.php | 4 ++-- dictionaries/CallMap_80_delta.php | 4 ++-- tests/MethodCallTest.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dictionaries/CallMap.php b/dictionaries/CallMap.php index ce0e546af96..d0f5a6f9e5f 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -1780,7 +1780,7 @@ 'DateTime::add' => ['static', 'interval'=>'DateInterval'], 'DateTime::createFromFormat' => ['static|false', 'format'=>'string', 'time'=>'string', 'timezone='=>'?DateTimeZone'], 'DateTime::createFromImmutable' => ['static', 'object'=>'DateTimeImmutable'], -'DateTime::createFromInterface' => ['self', 'object' => 'DateTimeInterface'], +'DateTime::createFromInterface' => ['static', 'object' => 'DateTimeInterface'], 'DateTime::diff' => ['DateInterval|false', 'datetime2'=>'DateTimeInterface', 'absolute='=>'bool'], 'DateTime::format' => ['string', 'format'=>'string'], 'DateTime::getLastErrors' => ['array{warning_count:int,warnings:array,error_count:int,errors:array}'], @@ -1800,7 +1800,7 @@ 'DateTimeImmutable::__wakeup' => ['void'], 'DateTimeImmutable::add' => ['static', 'interval'=>'DateInterval'], 'DateTimeImmutable::createFromFormat' => ['static|false', 'format'=>'string', 'time'=>'string', 'timezone='=>'?DateTimeZone'], -'DateTimeImmutable::createFromInterface' => ['self', 'object' => 'DateTimeInterface'], +'DateTimeImmutable::createFromInterface' => ['static', 'object' => 'DateTimeInterface'], 'DateTimeImmutable::createFromMutable' => ['static', 'datetime'=>'DateTime'], 'DateTimeImmutable::diff' => ['DateInterval', 'datetime2'=>'DateTimeInterface', 'absolute='=>'bool'], 'DateTimeImmutable::format' => ['string', 'format'=>'string'], diff --git a/dictionaries/CallMap_80_delta.php b/dictionaries/CallMap_80_delta.php index 9505b8878f1..e282a68c4c5 100644 --- a/dictionaries/CallMap_80_delta.php +++ b/dictionaries/CallMap_80_delta.php @@ -16,8 +16,8 @@ */ return [ 'added' => [ - 'DateTime::createFromInterface' => ['self', 'object'=>'DateTimeInterface'], - 'DateTimeImmutable::createFromInterface' => ['self', 'object'=>'DateTimeInterface'], + 'DateTime::createFromInterface' => ['static', 'object'=>'DateTimeInterface'], + 'DateTimeImmutable::createFromInterface' => ['static', 'object'=>'DateTimeInterface'], 'PhpToken::getTokenName' => ['string'], 'PhpToken::is' => ['bool', 'kind'=>'string|int|string[]|int[]'], 'PhpToken::isIgnorable' => ['bool'], diff --git a/tests/MethodCallTest.php b/tests/MethodCallTest.php index 0102eaf050a..76659e93c92 100644 --- a/tests/MethodCallTest.php +++ b/tests/MethodCallTest.php @@ -974,7 +974,7 @@ public static function new() : self { class Datetime extends \DateTime { - public static function createFromInterface(\DatetimeInterface $datetime): \DateTime + public static function createFromInterface(\DatetimeInterface $datetime): static { return parent::createFromInterface($datetime); }