I have a yii2 project set up on phpstorm 8.0.3. My namespace structure is as follows:
backend\
controllers
models
...
frontend\
controllers
models
..
common\
controllers
models
I used composer on the project and have various dependancies installed in the vendor folder.
Whenever I try to use a class that is not in the same base namespace (frontend
, backend
or common
), I get an undefined class error. The odd thing is the namespace of the class is in autocomplete:
Another oddity is that the undefined class error disappears for some classes if the file with the defined class is opened.
It looks like the PHPStorm cache was somehow corrupted. I ended up invalidating the cache by going to File
-> Invalidate Caches/Restart
. This deleted my history but fixed the undefined class issue.