I found reformatting php source code in phpstorm for particular file is Ctrl+Shift+Alt+L. But is there any way to do for whole project files?
In the Project tool window, right-click a module or a directory and from the context menu, select Reformat Code or press Ctrl+Alt+L .
Sometimes code formatting can get out of sync, but there's an easy fix in IntelliJ IDEA. You can use ⌘⌥L (macOS), or Ctrl+Alt+L (Windows/Linux) to reformat a selection of code according to your reformat settings.
The formatting shortcuts in Intellij IDEA are : For Windows : Ctrl + Alt + L. For Ubuntu : Ctrl + Alt + Windows + L. For Mac : ⌥ (Option) + ⌘ (Command) + L.
If you have issues opening the "reformat code" popup for multiple files, make sure that you don't have any open files as it'll otherwise only reformat the current open file (edit: sometimes - I still haven't been able to figure out why it allows you to reformat the entire code sometimes, but regardless, this fix will work if it doesn't allow you to).
You can simply right click any file on your file list and select "Close all".
After you've done this, select the folder you want to reformat in the code view:
Finally, with all files open you can now select "Reformat code" in the "Code" part of your main toolbar:
You'll now get the regular popup that most guides seem to mention, but that's otherwise hidden for some reason:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With