1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 13:51:54 +01:00

Removed DateTimeImmutable::setTimestamp() from the CallMap: fully covered by stub

Also simplified the return type from `static|false` to `static`, since
the method throws at all times, on failure.

On PHP 7.x, it could only fail if an invalid type was passed in, which is
not really valid anyway, from a type perspective.

Ref (PHP 8.1.x): 32d55f7422/ext/date/php_date.c (L3353-L3369)
Ref (PHP 7.0.33): bf574c2b67/ext/date/php_date.c (L3596-L3612)
This commit is contained in:
Marco Pivetta 2022-08-05 12:50:51 +02:00
parent 964f64a500
commit aaac9ccb90
3 changed files with 1 additions and 3 deletions

View File

@ -1798,7 +1798,6 @@ return [
'DateTimeImmutable::createFromInterface' => ['self', 'object' => 'DateTimeInterface'],
'DateTimeImmutable::createFromMutable' => ['static', 'datetime'=>'DateTime'],
'DateTimeImmutable::getLastErrors' => ['array{warning_count:int,warnings:array<int,string>,error_count:int,errors:array<int,string>}'],
'DateTimeImmutable::setTimestamp' => ['static|false', 'unixtimestamp'=>'int'],
'DateTimeInterface::diff' => ['DateInterval', 'datetime2'=>'DateTimeInterface', 'absolute='=>'bool'],
'DateTimeInterface::format' => ['string', 'format'=>'string'],
'DateTimeInterface::getOffset' => ['int'],

View File

@ -1059,7 +1059,6 @@ return [
'DateTimeImmutable::__wakeup' => ['void'],
'DateTimeImmutable::createFromMutable' => ['static', 'datetime'=>'DateTime'],
'DateTimeImmutable::getLastErrors' => ['array{warning_count:int,warnings:array<int,string>,error_count:int,errors:array<int,string>}'],
'DateTimeImmutable::setTimestamp' => ['static|false', 'unixtimestamp'=>'int'],
'DateTimeInterface::diff' => ['DateInterval', 'datetime2'=>'DateTimeInterface', 'absolute='=>'bool'],
'DateTimeInterface::format' => ['string', 'format'=>'string'],
'DateTimeInterface::getOffset' => ['int'],

View File

@ -91,7 +91,7 @@ class DateTimeImmutable implements DateTimeInterface
/**
* @psalm-mutation-free
* @return static|false
* @return static
*/
public function setTimestamp(int $unixtimestamp) {}