Reputation: 16365
IntelliJ IDEA usually highlights classes that are not imported through the use
keyword right before the class declaration. You can then ctrl-enter
to insert the use
import automatically.
It works on most of my projects, but not in all. Any idea where this can be set?
I use Version 15.0.3, Build #UI-143.1821 and the latest PHP Plugin.
Upvotes: 0
Views: 126
Reputation: 16365
Vladimir Luchansky wrote on the IntelliJ bugtracker:
Enable
File | Settings | Editor | Inspections > PHP | Undefined | Undefined class
it will bring back "Import class" intention.
That solves it.
How did it happen?
Turns out, I turned this inspection off when trying to get rid of a "multiple implementations exist" message (cannot avoid)
...and then:
Upvotes: 1
Reputation: 131
I have PhpStorm but I assume the settings look the same in Intelij IDEA with PHP plugin. That is, you should be able to find it under Settings > Editor > General > AutoImport. (Just search for "auto-import")
But it also may be that the location of that certain file cannot be found by PhpStorm/IntelliJ and you need to add it to your include path.
Upvotes: 1