I just installed Eclipse (Eclipse IDE for PHP Developers) and I’m currently testing it.
Seems great on many aspects, BUT…
… I get some warnings I’d like to get rid of, because they have no incidence and just tend to “hide” more useful warning hints.
Some variables/class instances used in all scripts are defined/instanciated in an “init.php” file.
This file is then included in all scripts where the variables/objects are needed.
=> this triggers warnings in the init.php file: “Variable ‘$foo’ is never used”. But it IS used in scripts where init.php is included, so this warning brings no useful information to me.
=> this triggers warnings in the script including init.php: “Variable ‘$foo’ is undefined”. It IS actually defined, but in the included file.
Is there a way to tell Eclipse “Ok, I know, you think it’s not used (or not defined), but please, just don’t tell me!” ?
In a comment with a specific syntax for instance?
Something comparable to javadoc for instance?
Or any other kind of meta-information intended to the editor?
Advertisement
Answer
Thanks @user10099 :
Adding
/** @var int $variable **/
before using the variable removed the “variable undefined” warning.Adding the same before defining the variable (in the included file) also removed the “variable never used” warning.