-
Notifications
You must be signed in to change notification settings - Fork 667
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
@var
annotation is ignored for class constants
#942
Comments
Just as a side note, the words |
Hey, @muglug. Is this still open ? Would like to start with this, looks interesting. |
Sure! Requirement: Nice-to-have: |
@muglug Thanks! I'll try it out 😄 |
When this is supported, it could be good for Psalm to only use the type for the rest of the analysis. That would resolve #2076. |
I just ran into this issue - reviewing a PR from a colleague using keys and values from two existing class constant arrays. I suggested typing the new constant using |
…-class-constants Support type annotations for class consts (fixes #942).
@orklah Can be closed, not sure why it didn't happen automatically with the commit message. |
It doesn't work in title and possibly not in commit message either. It has to be in the body of the PR I believe |
https://getpsalm.org/r/03a2f11ca3
Expected: should complain about
array<mixed,int> provided
Actual: complains about
array<empty,empty> provided
There's at least one usage of
@var
on constants in Psalm's tests:psalm/tests/ConstantTest.php
Lines 66 to 69 in 0ef71a4
Additionally, psalm seems to ignore
@var
and const initialization contradiction:The text was updated successfully, but these errors were encountered: