PHPStorm false Path not found message

Hi, 

I have just opened Moodle as a new project on PHPStorm, and i am having a few issues of false error warnings. 

require_once('config.php') is giving me an error :  Path 'config.php' not found 

Note that I can do , say, require_once('test.php') with no issue whatsoever, even if test.php is the exact copy of config.php 

Help?

There are a few other issues with undefined variables, but i am thinking that fixing the path thing may fix a few others. Since this is MOODLE, i can't really change the existing code. 

8 comments
Comment actions Permalink

Hello,

If you trigger the completion inside *require_once('')*, can you see the "config.php" there?

0
Comment actions Permalink

Hello, 

 

Did you mean code completion? Yes, config.php is listed as one of the options. Once selected, it then becomes underlined and gives me a false positive for an error. 

 

 

0
Comment actions Permalink

I guess, Ctrl+clicking on the filename doesn't work either?
Please try invalidating caches, maybe there's a corruption there.

0
Comment actions Permalink

Aha. Ctrl+clicking shows 'Multiple Implementation'.

On Searching Moodle CMS for config.php, there are literally 10 different config.php files spread all around the different directories.

Is this what is causing the error? But if so, why would code completion not show all 10 versions?

Also, why would Phpstorm not refer to the one that sits in the same directory as the current php page?

The PHPStorm is a fresh install - just yesterday updated.  

0
Comment actions Permalink

I have the same problem, but when I ctrl-click and choose the correct local version, the warning doesn't go away.

 

0
Comment actions Permalink

I have the same problem, but when I ctrl-click and choose the correct local version, the warning doesn't go away.

It's not supposed to, as you can't pick a correct file - in this dialog, you just select which definition you want to navigate to.

You need to specify the path in a more precise way, or limit the resolution scope (by adjusting PHP the Include list or Directories | Resource Roots).

0
Comment actions Permalink

Oh, what confused me was that choosing either of the file paths after Ctrl-clicking did nothing.  If it had resulted in loading the respective versions of the include files it would have been more clear.  I see now that even if I were to convince the editor that I wanted one file over another, this would not change the way PHP ran.  

It was silly, but I just changed the include to:

   include_once "../<proj dir>/include/...". 

Then the warning went away.   Still, I'd like phpstorm to know which file my PHP would really load, and just rock with that.  I'm not sure how to instruct phpstorm what my PHP's path preference is really going to be, which is current directory first.

0
Comment actions Permalink

Still, I'd like phpstorm to know which file my PHP would really load, and just rock with that.

0

Please sign in to leave a comment.