It's a known issue. AFAIK there is still no solid idea on why it happens and why only some users are affected.
https://youtrack.jetbrains.com/issue/WI-54626 -- watch this ticket (star/vote/comment) to get notified on any progress. Fixed in PhpStorm 2021.1.1 version.
Current workaround:
- Close IDE
- Locate folder where PhpStorm 2020.2 stores indexes/caches on your computer (see below)
- Delete that folder (as standard "Invalidate caches" does not help here)
- Launch IDE
Typical locations for caches folder for different OS:
- Windows:
%USERPROFILE%\AppData\Local\JetBrains\PhpStorm2020.2\caches
- Linux:
~/.cache/JetBrains/PhpStorm2020.2/caches
- macOS:
~/Library/Caches/JetBrains/PhpStorm2020.2/caches
For 2021.1 version: use File | Invalidate Caches...
-- it now better clears them so no need to delete such folders manually.
File | Invalidate Caches...
- Select top 2 options (maybe only 1st will be enough, but better use both)
- Use
Invalidate and Restart
button there
- After the IDE will restart, open the project and let re-indexing to complete.

If the issue persists (i.e. comes back the next day / after restart) then it's a different cause and you will have to wait for 2021.1.1 build.
undefined class Closure
, and ask me if I want to import, it is imported as you can seeuse Closure
but the IDE tryies to find a Closure class in the same folder and show me import options of Closure classes from vendor folderfile > Invalidate Cache or Restart
and invalidate the cache? Doing so forces the IDE to go dumb and learn all again, sometimes it helps!