46

I'm having trouble with PHPStorm. I just started new project created a couple of my own classes, in one of them I created PDO object.

$this->cnn = new PDO("sqlite:db/base.db");

Now when I want to see what kind of methods this object has via crtl + whitespace, I get no suggestions. Then I tried to see the list of classes available to me with.

$newClass = new

And when I pressed ctrl + whitespace it only showed me the classes I created.

So the question is, what do i need to do, to make PhpStorm see all the classes that are available (not just the ones i created).

P.S. when i ctrl + click on PDO (which is underlined) it says that class is undefined

P.P.S. in project settings i have selected php 5.4 language language and selected interpreter (php 5.4.7, using xampp)

EM-Creations
  • 4,195
  • 4
  • 40
  • 56
Darvex
  • 3,624
  • 2
  • 23
  • 39

2 Answers2

137

I've solved the issue. File > Invalidate Caches did the trick!

Darvex
  • 3,624
  • 2
  • 23
  • 39
  • 1
    This solved the issue, in the case of FuelPHP you also need to declare the use statements in order to get this work. `use \Fuel\Core\Validation;` or whatever. – Alrik Apr 13 '13 at 09:59
  • In my case I had updated xampp and moved an old phpstorm project to another directory, this answer sorted my issue and code completion is working as before – Carlton Feb 18 '14 at 11:05
  • that's really nice so my extensions are working with autocompletition :)) – Ilario Engler Apr 13 '16 at 20:14
  • In my case, PhpStorm recognized all classes except for those related to PDO (`PDO`, `PDOException`, `PDOStatement`, etc). Invalidating the caches fixed it! – Adrian Wiik Nov 04 '21 at 15:01
10

I had a problem with PHPStorm Code Analysis hanging up (never finishing) on certain files using certain classes. No errors were reported, but all code completion was not working in these problem files.

The solution was the same, File > Invalidate Caches.

jjjj
  • 101
  • 1
  • 2