-
Notifications
You must be signed in to change notification settings - Fork 237
/
.php-cs-fixer.dist.php
102 lines (94 loc) · 2.95 KB
/
.php-cs-fixer.dist.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
<?php
$header = <<<'EOF'
This file is a part of the DiscordPHP project.
Copyright (c) 2015-present David Cole <[email protected]>
This file is subject to the MIT license that is bundled
with this source code in the LICENSE.md file.
EOF;
$fixers = [
'blank_line_after_namespace',
'braces',
'class_definition',
'elseif',
'encoding',
'full_opening_tag',
'function_declaration',
'lowercase_keywords',
'method_argument_space',
'no_closing_tag',
'no_spaces_after_function_name',
'no_spaces_inside_parenthesis',
'no_trailing_whitespace',
'no_trailing_whitespace_in_comment',
'single_blank_line_at_eof',
'single_class_element_per_statement',
'single_import_per_statement',
'single_line_after_imports',
'switch_case_semicolon_to_colon',
'switch_case_space',
'visibility_required',
'blank_line_after_opening_tag',
'no_multiline_whitespace_around_double_arrow',
'no_empty_statement',
'include',
'no_trailing_comma_in_list_call',
'not_operator_with_successor_space',
'no_leading_namespace_whitespace',
'no_blank_lines_after_class_opening',
'no_blank_lines_after_phpdoc',
'object_operator_without_whitespace',
'binary_operator_spaces',
'phpdoc_indent',
'general_phpdoc_tag_rename',
'phpdoc_inline_tag_normalizer',
'phpdoc_tag_type',
'phpdoc_no_access',
'phpdoc_no_package',
'phpdoc_scalar',
'phpdoc_summary',
'phpdoc_trim',
'phpdoc_var_without_name',
'no_leading_import_slash',
'no_trailing_comma_in_singleline_array',
'single_blank_line_before_namespace',
'single_quote',
'no_singleline_whitespace_before_semicolons',
'cast_spaces',
'standardize_not_equals',
'ternary_operator_spaces',
'trim_array_spaces',
'unary_operator_spaces',
'no_unused_imports',
'no_useless_else',
'no_useless_return',
'phpdoc_no_empty_return',
'no_extra_blank_lines',
'multiline_whitespace_before_semicolons',
];
$rules = [
'concat_space' => ['spacing' => 'none'],
'phpdoc_no_alias_tag' => ['replacements' => ['type' => 'var']],
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
'header_comment' => ['header' => $header],
'indentation_type' => true,
'phpdoc_align' => [
'align' => 'vertical',
'tags' => ['param', 'property', 'property-read', 'property-write', 'return', 'throws', 'type', 'var', 'method'],
],
'blank_line_before_statement' => ['statements' => ['return']],
'constant_case' => ['case' => 'lower'],
'echo_tag_syntax' => ['format' => 'long'],
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
];
foreach ($fixers as $fix) {
$rules[$fix] = true;
}
$config = new PhpCsFixer\Config();
return $config
->setRules($rules)
->setFinder(
PhpCsFixer\Finder::create()
->exclude('examples')
->in(__DIR__)
);