PhpStorm does not recognize core PHP

PhpStorm does not recognize core PHP. For example, it does not recognize an Exception , while the tooltip says "Undefined class" Exception ".

I tried to invalidate the cache to no avail. I checked the installation of a colleague and they seem to have no problems, and after Ctrl+Clicking in the Exception class it correctly references Core_c.php , which is not suitable for me. It seems like my PhpStorm is not building a PHP plugin / library, and I have no idea why.

I tried reinstalling PhpStorm to the latest version, updating all my packages. I even made sure that the php.jar plugin is actually there, and this:

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

And the PHP plugin is included in PhpStorm.

Another problem with PhpStorm is that it does not offer function names whenever I type them. Help will be appreciated and I can provide additional information if necessary.

+5
source share
2 answers

I believe that we should consider some things here. What version of PHP are you using. Not all PHP versions support exception, and the namespace matters, except that you use the dependency manager, which can be configured with its namespace, but if you are building from scratch, you can consider the namespace and version of PHP

+1
source

If you work with php below 7.1, Exception will not work because it does not implement the Throwable class. The only way for your exception to work is if you extend the Exception class. What I also do is put a slash in front of the exception. How to throw new \InvalidArgumentException . Hope this works for you. Good luck.

0
source

Source: https://habr.com/ru/post/1263726/


All Articles