Jarek Jakubowski
Jarek Jakubowski

Reputation: 976

How to auto-import namespaces for whole PHP file in phpStorm?

How can I do something like NetBeans does with "Fix Uses..." (Ctrl+Shift+I) in PHPStorm, so I can fix FCQN in my project files?

What I already found is Alt+Enter on class name, but how can I do it for whole file?

Upvotes: 15

Views: 3272

Answers (2)

Ales
Ales

Reputation: 441

Its called "Optimize imports" and can be found in menu Code>Optimize imports. You can set keyboard shortcut for that. I have imported keyboard shortcuts from NetBeans so it remained the same, but the functionality is sometimes different than in NetBeans.

Upvotes: 1

Quentin Skousen
Quentin Skousen

Reputation: 1055

Currently you can't do this for a whole file. You are able to import on the fly, as documented here, but not for a pre-existing file. You might consider making a feature request for this.

Upvotes: 8

Related Questions