-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.php-cs-fixer.php
120 lines (110 loc) · 3.17 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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
$rules = [
// All of these presets inherit the preset listed prior. While it
// is not necessary to include them all individually, I am doing so
// for the sake of visibility into the global scope of rules being used.
'@PSR1' => true,
'@PSR2' => true,
'@PSR12' => true,
'@Symfony' => true,
'@PhpCsFixer' => true,
// Custom Overrides.
'declare_equal_normalize' => [
'space' => 'single',
],
'ordered_class_elements' => [
'order' => [
'use_trait',
'constant_public',
'constant_protected',
'constant_private',
'property_public',
'property_protected',
'property_private',
'construct',
'destruct',
'magic',
'phpunit',
'method_public',
'method_protected',
'method_private',
],
],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => [
'class',
'function',
'const',
],
],
'blank_line_before_statement' => [
'statements' => [
'break',
'case',
'continue',
'declare',
'default',
'exit',
'goto',
'include',
'include_once',
'require',
'require_once',
'return',
'switch',
'throw',
'try',
],
],
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'explicit_string_variable' => true,
'operator_linebreak' => [
'only_booleans' => true,
'position' => 'end',
],
// Turn both of these off (turned on from preset).
'php_unit_internal_class' => false,
'php_unit_test_class_requires_covers' => false,
'phpdoc_add_missing_param_annotation' => [
'only_untyped' => false,
],
// Turned on by preset. I prefer to be explicit.
'phpdoc_no_empty_return' => false,
// Also turned on by preset. I like to use these in certain scenarios.
'single_line_comment_style' => false,
'standardize_increment' => true,
// This should be after anything that modifies the increment logic.
'increment_style' => [
'style' => 'post',
],
// I like to keep my PHPDocs intact and explicit.
'no_superfluous_phpdoc_tags' => false,
'ordered_imports' => [
'sort_algorithm' => 'alpha',
],
'php_unit_method_casing' => false,
'phpdoc_types_order' => [
'null_adjustment' => 'always_last',
],
'not_operator_with_successor_space' => true,
'binary_operator_spaces' => [
'operators' => [
// This is broken, I'll have to align arrays myself.
'=>' => null,
],
],
'yoda_style' => false,
];
$excludes = [
'resources',
'vendor',
'storage',
'node_modules',
];
// We can also use "notPath()" to specify files alongside directories.
$finder = PhpCsFixer\Finder::create()->exclude($excludes)->in(__DIR__);
$config = new PhpCsFixer\Config();
return $config->setRules($rules)->setFinder($finder)->setLineEnding("\n");