1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

release:fix: Change return type of createFromInterface() methods on DateTime and DateTimeImmutable to 'static' so extending classes are recognized.

This commit is contained in:
Bitwise Operators 2022-06-13 10:00:38 +02:00
parent c74b2fcc1c
commit 651ad6cb50
3 changed files with 5 additions and 5 deletions

View File

@ -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<int,string>,error_count:int,errors:array<int,string>}'],
@ -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'],

View File

@ -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'],

View File

@ -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);
}