Unresolved includes

Is there a way to manually resolve include/require expressions?

Say we have expression like this:


This expression can not be resolved. Ok. But could I manualy point the desired file for IDE, to see classes in included fileand avoid  method and property not defined error messages.

Comment actions Permalink

Hi Dmitry,

AFAIK you cannot do it manually (I'm pretty positive about that), you can only suppress the warning (which only shown if appropriate inspection is turned on).

If that file is inside the project (and not in excluded folders) then PhpStorm should parse it with no issues and you will have autocompletion etc available. Autocompletion may not work properly (most likely) if you have more than one class with the same name -- which is a possible scenario -- since I do not know what files you are trying to include.

If that file is ouside project -- then you can include whole folder (or move file to separate folder and include it then) via 2 ways:
1) as part of the project in File | Settings | Directories -- "Add Content Root"
2) as external library in File | Settings | PHP

Comment actions Permalink

Not sure it will work for so complicated expression, but you could try
/** @define config::$params['foo'][bar'] 'your/path/' */
It works fine for more simple case like
/** @define $var 'my/path/' */

Comment actions Permalink

As far as I can tell, this will not work with arrays of any kind (I can't make it work, anyway.)

Comment actions Permalink

Thank you for responce. It is good news, that the IDE can recognize classes from project's files without explicit "require".

Seems that I have an error somewhere in class's code (large legacy spaghetti), which prevent properites to be determined.

Comment actions Permalink

Thanks for your comment.

Unfortunately this does not work with this construction...

Nevertheless it is not so bad as I've imagined -- classes are parsed regardless of the files included.


Please sign in to leave a comment.