IntelliJ IDEA 2016.3 Help

Move Namespace Dialog

The dialog box is available only if the PHP plugin is installed and enabled. The plugin is not bundled with IntelliJ IDEA, but it can be installed from the JetBrains plugin repository as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.

The dialog box opens when you select a PHP namespace to be moved and choose Refactor | Move on the main menu or on the context menu of the selection.

IntelliJ IDEA supposes that the namespaces in your project are arranged in compliance with the PSR0 standard and enforces you to retain the folder structure and the namespace hierarchy in accordance with this standard when moving namespaces.

When you specify a namespace to move a namespace to, IntelliJ IDEA automatically updates the Target Destination Directory field, which shows the path to the folder that corresponds to the namespace in question.

New Namespace Name When the dialog box opens, the field shows the fully qualified name of the selected namespace. Specify the new namespace name. Use only backslashes (\) as namespace separators.
Target Destination Directory When the dialog box opens, the field shows the path to the folder which corresponds to the current namespace.

The path is displayed in the format ...\<project root folder>\<path to the current namespace folder relative to the project root>. The path is updated automatically as you specify the new namespace name. However, if you are going to move a namespace to another parent namespace, IntelliJ IDEA will not suggest the proper folder unless you appoint a root folder for your namespace structure by marking the relevant folder as Sources on the Directories page of the Settings dialog box, see Directories for details.

Do one of the following:

  • Accept the preselected path displayed in the field.
  • Choose another path from the list. All of them are evaluated from the namespace root or from the current directory, so it is safe to choose any of them.
  • Click /help/img/idea/2016.3/browseButton.png and select a folder in the dialog box that opens.
  • Press F2 and edit the preselected path. Keep in mind that this may cause problems with automatic loading in the future.

Refactor Click this button to open the Move Files with Related Namespaces dialog box and specify the classes and files to be moved to the new namespace and the new folder.

The upper pane of the dialog box lists the destination namespaces and folders for classes and files related to the namespace in question. Each item in the list corresponds to a class/file. When you move the cursor to an item, the bottom pane shows the contents of the file related with it.


  • To have a class and the corresponding file moved to the destination namespace and the destination folder, select the check box next to the namespace/folder.
  • To add all the items to the list or remove all of them from the list, click Select All or Unselect All respectively.

See Also

Last modified: 21 March 2017