PhpStorm 8.0.2 Web Help

Safe Delete

The Safe Delete refactoring allows you to safely remove files and symbols from the source code.

To safely delete a symbol

  1. Select the symbol to be deleted.
  2. Choose Refactor | Safe Delete on the main menu or in the context menu of the selection or press Alt+Delete.

    Alternatively, press Delete in the Project tool window. Then you can either perform a Safe Delete or simply delete the symbol.

  3. In the Safe Delete dialog box that opens, specify additional settings for the refactoring:
    • To have the changes applied to comments and strings, select the Search in comments and strings check box.
    • To have the changes applied to text files (such as documentation, HTML, JSP and other files included in your project), select the Search for text occurrences check box.
  4. Click OK to continue. If no usages of the symbol are found, the refactoring removes the symbol. If PhpStorm finds any occurrences of the symbol in the code, the Usages Detected dialog box appears.
  5. In the Usages Detected dialog box, do one of the following:
    • To proceed with refactoring and delete the symbol, click the Ignore button, leaving all the usages of the symbol intact. In this case, to make your code compilable, you have to manually inspect the code and make the necessary corrections.
    • To view the list of direct usages of the symbol, click the View usages button. PhpStorm stops the refactoring procedure and the displays a list of direct usages of the selected symbol in the Find tool window. Navigate to each usage location and manually correct the code. When ready, click the Rerun Safe Delete button to invoke the refactoring again.

See Also

Last modified: 10 December 2014