同福

php storm的PHP代码样式(CodeStyle)

php storm

PHP代码样式

phpstorm默认的PHP代码样式比较适合小屏。现如今大屏幕随处可见,笔记本都是15寸起步,这个时候还用那种紧缩样式就有点得不偿失了。

现在跟着我进行一个调整吧

首先打开窗口 File -> Default Settings -> Code Style -> PHP

点开 Spaces 栏,展开 Before Parentheses

  • 去掉 'if','for','while','switch','catch' 几个的勾选

点开 Spaces 栏,展开 Before Left Brace

  • 去掉 Class,Function,'if','else','for','while','do','switch','try','catch','finally' 几个的勾选

点开 Spaces 栏,展开 Before Keywords

  • 去掉 'else','while','catch','finally' 几个的勾选

点开 Wrapping and Braces 栏,展开 Braces placement

  • In class declaration 改为 End of line

  • In function declaration 改为 End of line

点开 Wrapping and Braces 栏,展开 'if()' statement

  • 勾选 'else' on new line

点开 Wrapping and Braces 栏,展开 'do ... while()' statement

  • 勾选 'while' on new line

点开 Wrapping and Braces 栏,展开 'try' statement

  • 勾选 'catch' on new line

  • 勾选 'finally' on new line