How to reference (but not include) external files to not get "undefined function" warnings by PHPStorm?

Hi guys,

a.php gets executed which includes functions.php and b.php.  b.php contains function references which functions are defined in functions.php, but does not include functions.php directly.  PHPStorms highlights the "undefined" functions in b.php.  I don't wanna explicitly include functions.php from b.php.  How can I make PHPStorm figure out to use the functions defined in functions.php?

Thanks in advance,


Hi there,

If those are functions, then PhpStorm should pick them up as long as they part of the project (no need for explicit include/require statements -- just to be placed anywhere in a project). For example, this will work just fine (for PhpStorm when resolving function names):


$a = some_function('hello');
echo $a;


function some_function ($text)
    return '<[[' . $text . ']]>';

Since your description is very simplified, I cannot give you definite answer what you need to do.

Are you including some 3rd party library or what? If so -- then maybe include it into a project as External Library (Settings | PHP | Include paths) -- same kind of idea as PHP's own include_path settings.

If it's something else -- then please provide more details -- real example would be good.


Thanks for your quick reply!

Since then I created a simple project just like your example and there were no undefined messages displayed by PHPStorm, indeed.

Despite of this my own project still displayed these warnings.  At this point I copied my whole project into another directory and opened the copied project with PHPStorm.  Magic, everything worked!

I consider this issue resolved, althought chances are there is some bug lurking in the background.



In this case please try File | Invalidate Caches next time.


Will do.

Thanks for the excellent support!


Please sign in to leave a comment.