File Included By & Special PHPDoc Comments

I've got one file that declares some variables and then includes a second file. The second file, when opened, marks these variables as unknown. Is there a PHPDoc directive or some other way to let PhpStorm know that the second file is included by the first, so go to the first to resolve those variables?

Also... Just as a side note, is there a list of all of the PhpStorm-specific PHPDoc comments that control inspections, etc? Thanks.

Comment actions Permalink

Hi Robert,

1) If these variables are global -- then they should be picked up with no issues (at least it works for me). If you have include used inside some function & these variables are local variables (like in the example below) then IDE will not pick those variables up and the only way known to me how to inform IDE about this fact is to use PHPDoc comment in included file for each of such variable:


function some_function()
    $someVar = "meow";
    $anotherVar = 123;
    include "include.php";


/** @var $someVar string */
/** @var $anotherVar int */

echo $someVar;

2) I will just refer to already existing thread, especially these posts by Alexey: and

Comment actions Permalink

Thanks, that'll have to do. And thanks for the links too.


Please sign in to leave a comment.