Skip to content
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

Psalm error NonInvariantDocblockPropertyType #218

Closed
ddebin opened this issue Jan 28, 2022 · 1 comment
Closed

Psalm error NonInvariantDocblockPropertyType #218

ddebin opened this issue Jan 28, 2022 · 1 comment
Assignees
Labels

Comments

@ddebin
Copy link

ddebin commented Jan 28, 2022

Psalm made a design choice that class-level templates and static properties/method should not mix.
vimeo/psalm#7507
https://psalm.dev/r/f5f3b15557

With current annotations in AbstractEnumType, Psalm throw an error

ERROR: NonInvariantDocblockPropertyType - [...] - Property A::$choices has type array<array-key, mixed>, not invariant with Fresh\DoctrineEnumBundle\DBAL\Types\AbstractEnumType::$choices of type array<Fresh\DoctrineEnumBundle\DBAL\Types\TValue, Fresh\DoctrineEnumBundle\DBAL\Types\TReadable>

With code

/**
 * @extends AbstractEnumType<string,string>
 */
class A extends AbstractEnumType
{
    protected static array $choices = [ ];
}
@fre5h
Copy link
Owner

fre5h commented Jan 28, 2022

@ddebin Sorry, but this bundle doesn't use Psalm, it uses phpstan. I won't support both static analyzers. If you can create non-conflicted fix, I would consider it.

@fre5h fre5h self-assigned this Jan 28, 2022
@fre5h fre5h added the wontfix label Jun 7, 2022
@fre5h fre5h closed this as completed Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants