: Press Ctrl + Alt + Shift + L (Windows/Linux) or Cmd + Option + Shift + L (macOS) to open a dialog where you can choose to reformat only changed lines, optimize imports, or rearrange code. JetBrains +1 Automation & Shortcuts You can set PhpStorm to handle formatting automatically so you never have to think about it: Format on Save

Go to .

phpstorm format code