-
Notifications
You must be signed in to change notification settings - Fork 665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MethodSignatureMismatch - Argument 1 of DateTime::__unserialize has wrong type 'mixed', expecting 'array<array-key, mixed>' as defined by DateTimeInterface::__unserialize #8957
Comments
Can you check if it reproduces if you don't name your class Also, it seems that your snippet is not complete, it seems it should implement |
@orklah the I renamed the class from <?php
declare(strict_types=1);
namespace App\Extension\Type;
use DateTime;
class DateTime2 extends DateTime
{
public function __toString(): string
{
return $this->format('U');
}
} getting:
|
Oh, great, in 8.2, both DateTime and DateTimeInterface have a __unserialize method: https://3v4l.org/RtT39#v8.2.0 contrary to what we can find in documentation: https://www.php.net/manual/en/class.datetimeinterface.php So we're actually missing definitions for it in https://github.com/vimeo/psalm/blob/master/dictionaries/CallMap_82_delta.php We have an article about editing those files: https://psalm.dev/docs/contributing/editing_callmaps/ Are you up for a PR? :) |
@orklah have a look |
I'm still experiencing this issue with PHP 8.2.7 and Psalm 5.12 (also tried master, 5.11, 5.10, 5.9...) with errorLevel 7 or lower and this example:
Same error:
@orklah can you reopen this issue and have a look? |
Sounds like it needs all |
The error correctly disappear with #10131 with both PHP 8.1 or 8.2 (so does not sound like the definition in CallMap_82_delta is needed. |
Running on PHP 8.2, I have this code:
I cannot reproduce it on psalm.dev, but I assume it has to do with stubs.
Getting:
The text was updated successfully, but these errors were encountered: