0

I like ZendStudio feature when after typing class name and pressing "Enter" it automatically adds namespace use statement into the head of the script file.

Is it possible to do the same in the PhpStorm IDE?

5 Answers 5

3

Not sure if this has been there all the time, or if it a new addition but it can be done already.

On my case, you get on top of the class that you want the use imported and you press alt+Enter. A popup allowing you to select which namespace you want to import pops up.

You can see a more graphical explanation here:

PHP Storm Tricks: Add your USE Statements Automatically!

Sign up to request clarification or add additional context in comments.

Comments

3

I just wanted to disable it (it's native and enabled by default now) and found this SO thread.

For people like me, here's where the setting:

Editor > Auto-import > PHP - Enable auto-import in namespace scope

Comments

0

Please vote http://youtrack.jetbrains.net/issue/WI-1362

1 Comment

Not implemented yet. So sad ;(
0

In PHPStorm 6.0.3 on Mac (and presumably other platforms) you should follow the advice given by @Savageman. It worked for me.

Comments

-1

Go to "Settings" (Ctrl+Alt+S) > "Code Style > PHP" (I'm assuming you're using PS 3.0)

1 Comment

Can't find any reference about use statements in "Code Style".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.