PHP Storm Automatically reformat code on save

Automatically reformat code on save

You can configure the IDE to reformat code in modified files automatically when your changes are saved.

  1. Press Ctrl+Alt+S to open the IDE settings and select Tools | Actions on Save.

  2. Enable the Reformat code option.

  3. Additionally, you can configure the way the IDE will reformat your code:

    • Click Configure scope to specify the patterns of filenames and directories that you want to exclude from reformatting.

    • From the All file types list, select the types of files in which you want to reformat code.

    • Select Whole file or Changed lines if your project is under version control.

      If you select Changed lines, reformatting will apply only to the lines of code that have been changed locally, but not yet checked in to the repository.

Source:

https://www.jetbrains.com/help/phpstorm/reformat-and-rearrange-code.html#reformat-on-save


Leave a Reply

Your email address will not be published. Required fields are marked *