Reputation: 282845
The IDE (PS-117.65) is complaining that some of constants aren't defined.
I've defined them in a loop in another file. Can I put a doc comment at the top of this file to inform it about the constants? The usual /** @var
and @global
syntax doesn't seem to work for constants.
Upvotes: 5
Views: 2020
Reputation: 165118
There is no known to me PHPDoc comment to do that.
But you can "fake" them -- create some const.php
file and place it anywhere in a project (you can even place it in separate folder outside the project and attach it as External Library or as separate Content Root).
In this file -- define those constants with in a normal way: define("CONST_NAME", "value");
The "value" part can be anything (as long as types are matching -- useful for inspections/code analysis) -- it really depends where those constant will be used (e.g. if they are used in include/require statements, then it may be beneficial to have some real (or close to it) values there).
Upvotes: 6