BRIEFS logo BRIEFS

37: Code Style - Configuration

04/04/2016 , 3m

In episode 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 for pointing out the key mapping conflict on Ubuntu!

Docs

Questions/Comments/Suggestions

@PhpStormBriefs