Constants identification
Hello,
I am using a custom function to declare some global constants, this function simply declares the constant if it does not exist.
I am getting some trouble with PhpStorm because it is not identifying my constants. I would like to do it manually but it seems there is no way.
So I have 2 problems, or 2 possible missing solutions :
- PhpStorm identifies automatically / manually a constant function.
- PhpStorm takes care about a phpdoc tag declaring manually a global constant.
Example:
defifn('DEV_VERSION', !IS_WEB);
Typing DEV_ , ctrl + space, no suggestion.
Is there currently a solution I missed ? Else, could it be a planned feature ?
请先登录再写评论。
No, this should work fine.
Could you please attach a screenshot that would show this problem in your code?
@Loenix
Please provide the actual code to copy-paste next time... It's no fun to re-type it manually.
After looking through like 200 tickets (https://youtrack.jetbrains.com/issues/WI?q=define+constant) I have found these:
Sorry ... That was not the purpose...
It seems that https://youtrack.jetbrains.com/issue/WI-9270 is close but it has no valid solution.
Or should I create fake code to declare all constants ? It will be ugly...
Hello, It was 3 years ago and I am still having the same issue. Constants declared by a custom function are not recognized and we are unable to write phpdoc to declare it. I tried @const and @constant, but this is not working.
@Loenix
Seems like the best way here is still the same: define them in a normal way in a separate PHP file that will be used by the IDE only. Not the best way of course but it's better than nothing.
P.S. WI-42979 ticket is asking for the ability to define constants (their values?) via PHPDoc...