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
Internal Psalm error - Could not get class storage for class-string-map #9401
Comments
I found these snippets: https://psalm.dev/r/dd5e1b7f63<?php
interface FooInterface{}
final class Foo{}
class Container
{
/**
* @psalm-var class-string-map<T, T>
*/
public array $instances = [];
/**
* @psalm-param class-string-map<T,T> $instances
*/
public function setInstances(array $instances)
{
$this->instances = $instances;
}
}
|
Seems triggered by the missing template declaration: |
I found these snippets: https://psalm.dev/r/f35c5ac83a<?php
interface FooInterface{}
final class Foo{}
/**
* @template T
*/
class Container
{
/**
* @psalm-var class-string-map<T, T>
*/
public array $instances = [];
/**
* @psalm-param class-string-map<T,T> $instances
*/
public function setInstances(array $instances)
{
$this->instances = $instances;
}
}
|
Well, no errors for https://psalm.dev/r/b68a5f859b vs errors for another method: |
I found these snippets: https://psalm.dev/r/b68a5f859b<?php
class Container
{
/**
* @psalm-var class-string-map<T, T>
*/
public array $instances = [];
/**
* @psalm-param class-string-map<T,T> $instances
*/
public function __construct(array $instances)
{
$this->instances = $instances;
}
}
https://psalm.dev/r/86230c33fd<?php
class Container
{
/**
* @psalm-var class-string-map<T, T>
*/
public array $instances = [];
/**
* @psalm-param class-string-map<T,T> $instances
*/
public function setInstances(array $instances)
{
$this->instances = $instances;
}
}
|
Does it need template declaration? I thought https://psalm.dev/docs/annotating_code/type_syntax/utility_types/#class-string-mapt-as-foo-t |
I found these snippets: https://psalm.dev/r/f35c5ac83a<?php
interface FooInterface{}
final class Foo{}
/**
* @template T
*/
class Container
{
/**
* @psalm-var class-string-map<T, T>
*/
public array $instances = [];
/**
* @psalm-param class-string-map<T,T> $instances
*/
public function setInstances(array $instances)
{
$this->instances = $instances;
}
}
|
mmh, I may be wrong then, I don't use it often |
https://psalm.dev/r/dd5e1b7f63
The text was updated successfully, but these errors were encountered: