-
Notifications
You must be signed in to change notification settings - Fork 1
/
.php-cs-fixer.php
47 lines (43 loc) · 1.4 KB
/
.php-cs-fixer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'@PHP71Migration' => true,
'@PSR12' => true,
// 'strict_param' => true,
// 'array_syntax' => ['syntax' => 'short'], // 将 array() 改成 [] 短写形式
'ordered_imports' => [ // Ordering use statements.
'imports_order' => ['const', 'class', 'function'],
'sort_algorithm' => 'length', // 可选值:alpha/length/none
],
'concat_space' => [ // 连接字符是否需要空格
'spacing' => 'one',
],
'cast_spaces' => [ // A single space or none should be between cast and variable.
'space' => 'none', // 可选值:single/none
],
'binary_operator_spaces' => [ // 二元运算符留空
'default' => 'align_single_space',
],
'class_attributes_separation' => [ // Class, trait 和 interface 的属性是否需要一个空行隔开
'elements' => [
'const' => 'one',
'method' => 'one',
'property' => 'one',
],
],
];
$finder = Finder::create()
->in([
__DIR__ . '/src',
__DIR__ . '/examples',
])
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
return (new Config())
->setFinder($finder)
->setRules($rules)
->setRiskyAllowed(true)
->setUsingCache(true);