Phpstorm 2020.2 - PHP Built-In Functions Are Not Recognized

PhpStorm 2020.2 - PHP Built-in functions are not recognized

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:

  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

For 2021.1 version: use File | Invalidate Caches... -- it now better clears them so no need to delete such folders manually.

  1. File | Invalidate Caches...
  2. Select top 2 options (maybe only 1st will be enough, but better use both)
  3. Use Invalidate and Restart button there
  4. After the IDE will restart, open the project and let re-indexing to complete.

Sample Image

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.

PhpStorm does not recognize PHP functions

I found the reason. PhpStorm Php interpreter did not set correctly. After set interpreter and delete manually "caches" & "index" folders and restart Phpstorm it fixed successfully!

C:\Users{my_user}\AppData\Local\JetBrains\PhpStorm2020.3\caches
C:\Users{my_user}\AppData\Local\JetBrains\PhpStorm2020.3\index

My PhpStorm 5 does not know php native functions

Try File | Invalidate Caches, also check that PHP interpreter is configured for the project (File | Settings | PHP, Interpreter).

PhpStorm can't find DateTime

Comment from : @LazyOne fixed it for me

Check stackoverflow.com/a/64071021/783119

delete the chache folder: ~/.cache/JetBrains/PhpStorm2020.3/caches

PhpStorm not recognising core PHP

I believe we should consider some things here. What version of PHP are you using. Not all version of PHP supports Exception and the namespaces does matter except you are using a dependency manager which may come configured with its namespace but if you are building from scratch, you may want to consider the namespace and the version PHP

PhpStorm - remove 200 responses from console when using built in PHP server

Use Grep Console plugin for this -- should do the job fine (does so in similar consoles).

Based on your requirements it allows you to:

  • change color for the matching text (or whole line if desired) based on presence of some marker (matching text)
  • or even hide (filter out) such line completely.

Your marker here could be [200]: for successful responses -- this is a simple "match the exact text" pattern. If it does not work (e.g. because this text is in the middle of the string .. or because it looks like regex (as [] have special meaning in regex)) then just convert it into proper regex: .*\[200\]:.* -- something like that should do.


Example of how it works:

Sample Image

The rule for that is highlighted (plain string as it's a very simple rule -- match exact string):

Sample Image

Getting an “Undefined constant '__NAMESPACE__'” error in PhpStorm even after a namespace has been defined

I emailed JetBrains support and they got back to me with the fix and it is exactly what @LazyOne mentioned in the comments section above.

I simply deleted the following folder on my Mac and it resolved the issue:

~Library/Caches/JetBrains/PhpStorm2020.2



Related Topics



Leave a reply



Submit