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

Deprecated Template Classes are not ignored by @psalm-suppress DeprecatedClass #10490

Open
blackthornedk opened this issue Dec 14, 2023 · 1 comment

Comments

@blackthornedk
Copy link

https://psalm.dev/r/3876267f03

I'm deprecating a lot of classes, which extend each other, using templated classes. (Symfony Entities and Repositories).
When the deprecated class is used in a @extends annotation, psalm does not respect the @psalm-suppress DeprecatedClass annotation.
As far as I could tell, all other forms of suppression seem to work.

It would also be nice, if a deprecated class did not automatically trigger a deprecation warning.
This could be selectable by a flag in the config.
It would eliminate the need for suppression annotations, when a chunk of the codebase is deprecated together.

Copy link

I found these snippets:

https://psalm.dev/r/3876267f03
<?php

/**
 * @template T of object
 */
class A {
    
}

/**
 * @deprecated
 */
class B {
}

/**
 * @extends A<B>
 * @deprecated
 * @psalm-suppress DeprecatedClass
 */
class C extends A {
}

/**
 * @deprecated
 * @psalm-suppress DeprecatedClass
 */
class D extends B {
}

/**
 * @deprecated
 * @psalm-suppress DeprecatedClass
 */
class E {
   public ?B $property = null; 
}
Psalm output (using commit a75d26a):

ERROR: DeprecatedClass - 21:7 - Class B is marked as deprecated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant