Warm tip: This article is reproduced from serverfault.com, please click

Declarations not found in large files, PhpStorm 2018.3.3

发布于 2019-01-25 18:51:20

So I have an old project with some pretty large files (5000+ lines). I have upgraded to the latest PhpStorm and it has not fixed my issue.

My issue is that method calls are not linked to their declaration and are highlighted as such. If I try to control+click on the method name it tells me "cannot find declaration to go to".

The correct USE line is at the top of the file and I know it should be working because if I simply delete the bottom 1/4 of the file it starts working. I have tried narrowing down what code causes it to happen in the file, but it really just comes down to how much code is removed, not which code is removed.

I have increased my memory via my options file to no avail, and I am running the 64 bit version:

-Xms1024m
-Xmx2048m
-XX:ReservedCodeCacheSize=1024m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Dhidpi=true
-Dawt.useSystemAAFontSettings=lcd
-Dawt.java2d.opengl=true

What can I do to increase the number of lines this software can deal with. Disabling inspections has no effect. Invalidating caches and restarting has no effect. Deleting my .idea folder has no effect.

Questioner
Rick Kukiela
Viewed
0
phpdevmike 2020-12-02 23:46:30

I ran into the exact same problem on version 2020.2 of PHPStorm and ended up contacting JetBrain's tech support. Unfortunately the only solution is to refactor your code. This was JetBrain's answer: "The reason for that behavior is that the control flow is too long to analyze.

It's this one: https://youtrack.jetbrains.com/issue/WI-41610

And partially, this one: https://youtrack.jetbrains.com/issue/WI-31569

Unfortunately, there's nothing you can do to work that around on your side"

Basically if the file has too many method calls and/or has too many lines of code, the IDE can't analyze the file. So you have to shorten the script enough to allow PHPStorm to analyze it. Beware that this will also affect refactoring in PHPStorm because it won't find usages of methods in those long files that are affected by this bug.