Code Formatting Tweaks for PhpStorm 2017.2
We’re constantly trying to improve our code formatting options so that everyone gets to automatically format their code just as they like it, and PhpStorm 2017.2 is no different.
We’ve added several new formatting options in PhpStorm 2017.2:
- Add spaces around the `??` when using the null coalesce operator using Preferences | Code Style | PHP | Spaces | Null coalesce operator
- More flexibility adding blank lines to your code – after a closing curly brace, after the opening PHP tag in a file, and after a function declaration. You’ll find them under Preferences | Code Style | PHP | Blank Lines
- Format `if` statements perfectly using New line after ‘(‘ and Place ‘)’ on one line in Preferences | Code Style | PHP | Wrapping and Braces
- Format closures differently from other functions using the closure options added to Preferences | Code Style | PHP | Wrapping and Braces
As PHP evolves so does the exacting code formatting that we use to keep our code looking just as we like it – if there’s something missing then please let us know.
– Gary & The PhpStorm Team