Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhpStorm not recognising core PHP

Tags:

php

phpstorm

PhpStorm isn't recognising core PHP. For example, it's not recognising Exception, with the tooltip saying "Undefined class 'Exception'".

I've tried invalidating the cache to no avail. I've checked a colleague's installation and they appear to have no issues, and after Ctrl+Clicking on their Exception class, it links correctly to Core_c.php, which isn't the case for me. It seems like my PhpStorm isn't picking up the PHP plugin / library, and I have no idea why.

I've tried reinstalling PhpStorm to the latest version, upgrading all of my packages. I've even made sure that the php.jar plugin is actually there, and it is:

/opt/phpstorm/plugins/php/lib/php.jar

And the PHP plugin is enabled in PhpStorm.

Another problem I have with PhpStorm is that it isn't suggesting function names whenever I type them. Help would be appreciated, and I can provide additional information if needed.

like image 293
driima Avatar asked Feb 02 '17 10:02

driima


1 Answers

In case that same issue appears for PhpStorm 2020.1 or later, that's a previously reported issue and invalidating caches won't help anymore.

As described here the solution is:

  1. Close IDE
  2. Locate folder where PhpStorm 2020.2 stores indexes/caches on your computer (see below)
  3. Delete that folder (as standard "Invalidate caches" does not help here)
  4. 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

https://youtrack.jetbrains.com/issue/WI-54626

like image 114
Ebrahim Imami Avatar answered Sep 29 '22 16:09

Ebrahim Imami