-
Notifications
You must be signed in to change notification settings - Fork 663
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
Wrong type with static #7507
Comments
I found these snippets: https://psalm.dev/r/f5f3b15557<?php
/**
* @template T
*/
class Foo
{
/**
* @var T[]
*/
protected array $A = [];
/**
* @var T[]
*/
protected static array $B = [];
}
|
This is on purpose. Psalm made a design choice that class-level templates and static properties/method should not mix. |
Related to #5753 and #7482. Class templates are currently ignored on static properties and methods. I think there are some cases where this should be allowed for methods, but it could cause harder problems if allowed on properties: https://3v4l.org/ZcQMS. We'll have to think over it carefully if we decide to support it in the future. |
Wrong type resolution when class property is defined as
static
.https://psalm.dev/r/f5f3b15557
The text was updated successfully, but these errors were encountered: