Search code examples
zend-studiophpstorm

PhpStorm configuration for automatic creation of the class namespace use statement like in ZendStudio


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?


Solution

  • 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!