/
.php_cs.dist
72 lines (66 loc) · 1.82 KB
/
.php_cs.dist
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
use PhpCsFixer\Finder;
use PhpCsFixer\Config;
// Directories to exclude when fixing files.
$exclude = [
'bootstrap/cache',
'vendor',
'storage',
'node_modules',
'nbproject',
];
// Filename patterns to exclude when fixing files.
$notName = [
'*.md',
'*.yml',
'*.xml',
'_ide_helper.php',
'_ide_helper_models.php',
'.phpstorm.meta.php'
];
// Default rules set to use when fixing files.
// See : https://gistlog.co/sixlive/2862a2185c76988838acaa45687a575c
$rules = [
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => [
'syntax' => 'short',
],
'no_blank_lines_after_phpdoc' => true,
'no_extra_blank_lines' => [
'tokens' => ['curly_brace_block', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'throw', 'use'],
],
'no_multiline_whitespace_before_semicolons' => true,
'no_short_echo_tag' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'not_operator_with_successor_space' => true,
'ordered_imports' => [
'sortAlgorithm' => 'length',
],
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_indent' => true,
'phpdoc_no_package' => true,
'phpdoc_order' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_var_without_name' => true,
'single_quote' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
];
// Instantiate finder.
$finder = Finder::create()
->in(getcwd())
->exclude($exclude)
->name('*.php')
->notName($notName)
->ignoreDotFiles(true)
->ignoreVCS(true);
// Instantiate & return config.
return Config::create()
->setFinder($finder)
->setRules($rules);