Add constant fetch to reference map#5115
Merged
muglug merged 3 commits intovimeo:masterfrom Jan 28, 2021
Merged
Conversation
To support showing constant types on hover of constant references, we need to add them to the ref map.
Collaborator
|
Mind fixing the Psalm issue and test? |
Contributor
Author
|
@muglug sorry, was looking for some guidance on:
Do you know what I'm doing wrong here? Where should I be looking for storage of constants in the root NS? |
Collaborator
|
|
Contributor
Author
|
Ok fixed up the tests, I was wrongly assuming that defining a constant in any file will cause it to be added to global constants, but that doesn't seem to be the case. I guess just because a constant is defined in any file doesn't mean it is considered globally defined, as that file may not be loaded. |
Collaborator
|
Thanks! |
danog
pushed a commit
to danog/psalm
that referenced
this pull request
Jan 29, 2021
* Add constant fetch to reference map To support showing constant types on hover of constant references, we need to add them to the ref map. * Fix root constants * PHPCBF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To support showing constant types on hover of constant references, we need to add them to the ref map.
I'm not sure on the best format for the Symbol Information, I went with
const APPLE stringbut perhaps there's a better formula to use here?For global constants (though not in a namespace), I wasn't yet able to see where they were stored (see the failing test). It looks like
Codebase::getStubbedConstantType()doesn't have it.I'm also adding this to support both constant compleitions, but also it will mean effectively any word in typing will become a
*unknown_constreference.