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 ce0e546af..d0f5a6f9e 100644 --- a/dictionaries/CallMap.php +++ b/dictionaries/CallMap.php @@ -1780,7 +1780,7 @@ return [ '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 @@ return [ '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 9505b8878..e282a68c4 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 0102eaf05..76659e93c 100644 --- a/tests/MethodCallTest.php +++ b/tests/MethodCallTest.php @@ -974,7 +974,7 @@ class MethodCallTest extends TestCase class Datetime extends \DateTime { - public static function createFromInterface(\DatetimeInterface $datetime): \DateTime + public static function createFromInterface(\DatetimeInterface $datetime): static { return parent::createFromInterface($datetime); }