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
allow marking enum cases as deprecated #7192
Conversation
Attributes are available on enum cases:
|
9e24c43
to
1df74bd
Compare
thanks. I must have been looking at the wrong spot then (the I'll check later (tomorrow Europe time - I'm on family duty now) and update the PR |
8e6f59d
to
ee9ee94
Compare
yes. you were totally right. the attributes are available. I have pushed a second commit that adds support for the The patch as shown on GitHub looks a bit crazy because I have extracted the attribute resolution into a new method as it was exactly identical for the property storage too |
I pushed another commit that updates the docs. However, that fails a test because the documentation samples are checked (very cool) with php 8.0 (not so good). How should I proceed?
|
Let's upgrade that to 8.1, it should not be an issue |
05e12df
to
2a33309
Compare
Wouldn't adding the issue to the list below suffice? psalm/tests/DocumentationTest.php Lines 312 to 318 in 646ba98
|
src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php
Outdated
Show resolved
Hide resolved
just like with properties, this recognizes both `Psalm\Deprecated` and `JetBrains\PhpStorm\Deprecated`
yes. you're right. I noticed only after asking about the general PHP update, so that what I've done. In my rebased commits, I have removed the PHP version change and followed your suggestion. |
2a33309
to
fdeb195
Compare
Thanks! |
This PR will allow an
@deprecated
annotation to be placed on enum cases which will then cause aDeprecatedConstant
issue to be raised when the case is being referenced.I'm unsure as to whether this is the correct way to do things as I'm not too familiar with the psalm internals, so I'm very happy about pointers in how to do this correctly.
Also, ideally, I would like to have supported the#[Psalm\Deprecated]
attribute too, but I don't think the php parser is exposing attributes on enum cases - at least I could not get to them, but maybe I looked in the wrong spot.