In episode 34 (https://www.briefs.fm/phpstorm-briefs/34) I introduced the
Code Sniffer tool that can warn you about code style violations as you
type. But there is also a built-in tool that lets you reformat your code
after it is written to a particular style. In this episode I talk about how
to configure PhpStorm to reformat your code to a particular style.
Also applies to: WebStorm
Key mappings
OSX:
- Open Code Style Preferences: Shift + Command + A + "Code Style"
- Reformat Code: Command + Alt + L
Win/Linux:
- Open Code Style Preferences: Shift + Ctrl + A + "Code Style"
- Reformat Code: Ctrl + Alt + L (Conflicts with Lock screen on Ubuntu)
Thank you @recchiapiero (https://twitter.com/recchiapiero) for pointing out the key mapping conflict on Ubuntu!
Docs
Code Style (https://www.jetbrains.com/phpstorm/help/code-style.html)
Questions/Comments/Suggestions
@PhpStormBriefs (https://twitter.com/phpstormbriefs)