Navigating to include, function and constant references

In this context, "include" includes the include_once, require_once and require statements. Also in the following, when I say "get a list", I mean a list from which I can navigate to the items in the list.

  1. Given a PHP file, is it possible to get a list of files that include it?
  2. Given a function (that is not in a class) is it possible to get a list of files that call it?
  3. Given a constant (defined by "define") is it possible to get a list of files that use it?

In other words, I know that from an "include" in a file I can navigate to the included file. Does PhpStorm provide a convenient mechanism to navigate to the next file that has an "include" of the file? I am asking about the same type of thing for functions and constants too.

0
2 comments

Hi there,

#2 & #3 -- yes -- just use one of the "Edit | Find | Find Usages" actions on it. It will not be "a list of files" -- more a list of particular places in a code ... which can be grouped by files

#1 -- maybe as well (not using it myself much -- why use includes when class autoloading does almost all the job), but:

1) You have to invoke that Find Usages action on actual file and not function/element

2) Such includes should be properly recognized/interpreted by PhpStorm. In other words -- if include/require shows warnings (e.g. "cannot resolve path to xxx file" or whatever) then no such reference link is created and this include will not be in that found usages list

0
Avatar
Permanently deleted user

Thank you, Andriy. Yes, that works. I have spent very much time searching for those. I even did not find this forum when I tried searching for PhpStorm forums. Later it finally popped up in some results for something else.

Certainly "Find Usages" is right there in the sub-menu but I guess I was not expecting the term "usages".

Whatever the lists are or are not, they are what I was looking for. The lists are in a useful tree.

0

Please sign in to leave a comment.