-
Notifications
You must be signed in to change notification settings - Fork 668
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
Assignment of empty SplObjectStorage #4055
Labels
Comments
I found these snippets: https://psalm.dev/r/747947d7b6<?php declare(strict_types = 1);
class HelloWorld
{
/**
* @var SplObjectStorage<DateTimeImmutable, null>
*/
public SplObjectStorage $dates;
public function __construct()
{
$this->dates = new SplObjectStorage();
}
}
|
It's because the constructor doesn't take templated params, so there's nothing to be considered empty. I think the only way around this is to hack things a bit. |
I think it's sufficient to add the constructor with type variable parameters. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There seems to be some issue with SplObjectStorage - I can't assign empty SplObjectStorage to an annotated property. Note that this works just fine for other generic types since b26deb4.
https://psalm.dev/r/747947d7b6
The text was updated successfully, but these errors were encountered: