You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?php/** * @template TModel of Model */trait HasCollection {
/** * @return list<TModel> */publicfunctionget(): array
{
return [];
}
}
class Model
{
/** * @use HasCollection<static> */use HasCollection;
}
class MyClass extends Model {
}
$class = newMyClass();
$result = $class->get();
/** @psalm-trace $result */
Psalm output (using commit 765dcbf):
INFO: Trace - 29:28 - $result: list<MyClass&static>
INFO: UnusedVariable - 27:1 - $result is never referenced or the value is not used
ERROR: InvalidTemplateParam - 20:8 - Extended template param TModel expects type Model, type static given
Example:
https://psalm.dev/r/f8c1600e03
Result:
ERROR: InvalidTemplateParam - 20:8 - Extended template param TModel expects type Model, type static given
Expects:
No errors.
Phpstan example: https://phpstan.org/r/b6e3f530-00ef-4bf5-9610-59bacad09f8d
The text was updated successfully, but these errors were encountered: