PhpStorm常用的一些配置

aries 发表于 2017-10-25 1535 次浏览

一. 数据键值对齐

Settings (Preferences on Mac) | Editor | Code Style | PHP | Other | Array declaration style -> Align key-value pairs (勾选)

效果:

原数组:
$array = [
    'foo'=>'123',
    'barrrrr'=>'234',
    'abcdefghijklmn'=>'456'
];
格式化代码后(Code -> Reformat code)
$array = [
    'foo'            => '123',
    'barrrrr'        => '234',
    'abcdefghijklmn' => '456'
];

二. 变量赋值对齐

Settings (Preferences on Mac) | Editor | Code Style | PHP | Wrapping and Braces -> Assignment Statement -> Align consecutive assignments (勾选)

$sExample = 'Example !';
$sAnotherOneHere = 'Again ?';
$sAndTheLast = 'ENOUGH !';

$sExample        = 'Example !';
$sAnotherOneHere = 'Again ?';
$sAndTheLast     = 'ENOUGH !';

三. 类和方法的花括号跟在方法名后面

Settings -> Editor -> Code style -> PHP -> Wrapping and Braces -> Braces placement -> In function declaratio (Or In class declaratio) -> end of line (勾选)

<?php
class Foo
{

}
<?php
class Foo{

}

0条评论

如需评论,请填写表单。
换一个

记住我的信息