PHP defined constants unable to be found

I'm using PHPStorm 3.0 (build 111.19) and when I right-click on a defined constant and choose "Find Usages..." the result is unpredictable.

I have several defined constants, but here are two that are declared together:


With PHPStorm displaying the file in which these are declared and a file in which both are used, I right-click on the declared constant, choose "Find Usages..." and discover that PHPStorm instantly "sees" all uses of THUMBNAIL_PATH.

But when I try it with DISPLAY_PATH it does not find it. I can even add a line and use it (like $f = DISPLAY_PATH) and PHPStorm still fails to locate it. Even though I have the file open and can see the defined constant in use, PHPStorm does not find it.

And here's where it gets really weird.

If I change the definition to "DISPLAY_PAT" (drop the final 'H') and change the constant in the file where it's used, PHPStorm finds it.

So if I change the definition from DISPLAY_PATH to DISPLAY_PAT it will work.

(I tried to do a Project-wide search for DISPLAY_PATH and it always works and finds all usages, but I'd prefer to use the contextual menu and have it function correctly.)


Hi Marty,

To start -- try "File | Invalidate Caches ..." -- possibly you do have somehow corrupted indexes/caches.

If no difference -- what do you see when Ctrl+Click on constant on such code? Maybe it is declared multiple times somehow?


I had already done "Invalidate caches" in an attempt to solve the problem. I then restarted and let PHPStorm rebuild the indexes.

The problem occured as described again.

I'm on a Mac, so when I Ctrl+Click it brings up the contextual menu. (Same as right-click on the Mac.)

However, it WAS defined in another file and when I commented out that definition it worked.

SOLUTION: Insure that there are not duplicated declarations when using "Find Usages..."

Thanks for your assistance. PHPStorm rocks!


Please sign in to leave a comment.