PHP built in functions/classes etc. are not recognized

After a restart of PhpStorm it started to highlight all built in classes (e.g. \Exception) as undefined and it also doesn't hint php built in functions (e.g. \trim, \strtolower) while typing. It looks like it suddenly doesn't know native php :-) What settings should I check to make everything work again?

Thank you.

9

I was looking for it for half an hour and of course, right after posting this question, I found it :)

"Settings/Languages & Frameworks/PHP/PHP Runtime/Sync Extensions with Interpreter."

0

Hello, I have this same problem.

Phpstorm is complaining that is_numeric is an unknown/undefined function.

I have gone to "Settings/Languages & Frameworks/PHP/PHP Runtime/Sync Extensions with Interpreter." but this doesn't fix it.

I have coding for PHP 7.2 and have pointed the CLI interpreter to a PHP 7.2 executable. What else can I do?

Thank you

 

0

Elliot, could you please show the context? I just tried "is_numeric" function on a simple example in PhpStorm and no warnings are shown. Moreover, autocomplete is working for it.

0

I encountered the same problem, where native classes and functions were not being recognized by PhpStorm (2019.1.2).

It appears something in the cache/indexing was corrupted as I couldn't pull up any quick documentation on it, nor could I navigate (Ctrl + click) to the definition... No obvious cause found...

The solution for me was to invalidate my cache (File->Invalidate Caches / Restart)

After re-indexing and re-caching it is working as expected now.

11

I had this problem ocour after I created functions.php file in src for symfony. Cache revalidation helped.

-1

It happened to me after running an update. David's method cleared it up.

0

 

Had the same problems, and only

  • disabling some 3rd party plugins

helped. I had two new RDF related plugins installed (LNKD.tech Editor, RDF and SPARQL). After disabling them PHPStorm again recognized php standard functions etc.

1

The same happened today after snap update.
Details:

PhpStorm 2020.2
Build #PS-202.6397.115, built on July 29, 2020
Licensed to PhpStorm Evaluator
Expiration date: August 29, 2020
Runtime version: 11.0.7+10-b944.20 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.4.0-42-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 841M
Cores: 4
Registry: run.processes.with.pty=TRUE
Non-Bundled Plugins: com.aurimasniekis.phppsr4namespacedetector, ru.adelf.idea.dotenv
Current Desktop: ubuntu:GNOME

2

Please try disabling all custom plugins at Settings | Plugins > click on a gear icon > "Disable All Downloaded Plugins", restart IDE and check the issue after that. 

0

I've tried disabling all plugins with built-in, cache clear, removing idea project dir. No luck!

0

Please try opening plugins directory and delete all plugin folders manually. and then restart IDE. If that doesn't help - please attach a screenshot of the problem + share your idea.log file. You can also contact us via Help | Contact Support to do this privately.

1

No luck. But I've just left my PC for few minutes and it works! Some background process...

0

I got the same bug after updating it to 2020.2

4

Same here :(

IntelliJ IDEA 2020.1.4 (Ultimate Edition)
Build #IU-201.8743.12, built on July 21, 2020
Runtime version: 11.0.7+10-b765.65 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.6
GC: ParNew, ConcurrentMarkSweep
Memory: 1981M
Cores: 8
Registry: suggest.all.run.configurations.from.context=true
Non-Bundled Plugins: Dart, io.flutter, Pythonid, com.jetbrains.php

0

Worked when I upgraded to

IntelliJ IDEA 2020.2 (Ultimate Edition)
Build #IU-202.6397.94, built on July 27, 2020
Runtime version: 11.0.7+10-b944.20 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.6
GC: ParNew, ConcurrentMarkSweep
Memory: 1981M
Cores: 8
Registry: suggest.all.run.configurations.from.context=true
Non-Bundled Plugins: Dart, io.flutter, com.jetbrains.php, Pythonid

-1

I have the same Issue since i updated.

PhpStorm 2020.2
Build #PS-202.6397.115, built on July 29, 2020
Licensed to active value GmbH / Chris Adam
Subscription is active until June 16, 2021
Runtime version: 11.0.7+10-b944.20 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.0.0-38-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 1917M
Cores: 12
Registry: run.processes.with.pty=TRUE, ide.balloon.shadow.size=0
Non-Bundled Plugins: com.chrisrm.idea.MaterialThemeUI, com.jensteichert.themes.nightowl, com.mallowigi, de.espend.idea.php.annotation, fr.adrienbrault.idea.symfony2plugin, izhangzhihao.rainbow.brackets
Current Desktop: ubuntu:GNOME

3

I have this issue too after update to PhpStorm 2020.2

 

PhpStorm 2020.2
Build #PS-202.6397.115, built on July 29, 2020
Runtime version: 11.0.7+10-b944.20 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1981M
Cores: 8
Registry: run.processes.with.pty=TRUE, debugger.watches.in.variables=false
Non-Bundled Plugins: de.netnexus.camelcaseplugin, intellij.prettierJS, de.espend.idea.laravel, com.kalessil.phpStorm.phpInspectionsEA, de.espend.idea.php.annotation

3

I reinstalled PHPStorm with https://www.jetbrains.com/toolbox-app/
and the issue was resolved

5

Same issue after updating to 2020.2

6

To everyone still affected: please try the latest suggestion posted here by me. If this won't help - please contact us directly over Help | Contact Support

-3

Disabling plugins and invalidating the cache didn't help.

 

As a workaround I found this solution: https://stackoverflow.com/questions/30328805/phpstorm-how-to-add-method-stubs-from-a-pecl-library-that-phpstorm-doesnt-curr

 

1. Clone the stubs repository

2. Configure the default stubs path

6

Same issue after updating to 2020.2. I tried to delete all plugins folders as you mentioned, delete .idea file of my project, restore default settings, reinstall PHPStorm... None of these solutions work.

 

Edit: The solution proposed by Arjan Frans temporarily solves the problem, thanks.

0

1) do you have PhpStorm installed via ToolBox app or a standalone app or via snap?

2) do you have "Core" PHP runtime enabled at File | Settings | Languages & Frameworks | PHP?

1

Arjan Frans thank you that actually helped!

0

Dmitry Tronin my PHPStorm is installed as a standalone app and "Core" PHP runtime is enabled. FYI, the solution proposed by Arjan Frans solves the problem.

 

PhpStorm 2020.2
Build #PS-202.6397.115, built on July 29, 2020
Licensed to La Coopérative des Tilleuls / Baptiste Meyer
You have a perpetual fallback license for this version
Subscription is active until July 30, 2021
Runtime version: 11.0.7+10-b944.20 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.5
GC: ParNew, ConcurrentMarkSweep
Memory: 4062M
Cores: 4
Registry: run.processes.with.pty=TRUE

 

0

Thanks for the info, but it's still not clear how did it happen. If anyone affected could share their logs via Help > Collect Logs and Diagnostic Data with us that would be great. 

0

Logs are looking alright.

Could you please:

1) attach a screenshot of File | Settings | Languages & Frameworks | PHP > PHP Runtime > Core 

2) share your project's /.idea folder

0

请先登录再写评论。