This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.php_cs
148 lines (105 loc) · 5.67 KB
/
.php_cs
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
// Rules for Laravel Code Standard
$rules = [
'@PSR2' => true,
// PHP arrays should be declared using the configured syntax.
'array_syntax' => [
'syntax' => 'short', //whether to use the long or short array syntax;
],
// Binary operators should be surrounded by at least one space.
'binary_operator_spaces' => [
'align_double_arrow' => true, // whether to apply, remove or ignore double arrows alignment
'align_equals' => false, // whether to apply, remove or ignore equals alignment
],
// Ensure there is no code on the same line as the PHP open tag and it is followed by a blank line.
'blank_line_after_opening_tag' => true,
// An empty line feed should precede a return statement.
'blank_line_before_return' => true,
// A single space should be between cast and variable.
'cast_spaces' => true,
// Concatenation should be spaced according configuration.
'concat_space' => [
'spacing' => 'none', // spacing to apply around concatenation operator
],
// Include/Require and file path should be divided with a single space. File path should not be placed under brackets.
'include' => true,
// There should be no empty lines after class opening brace.
'no_blank_lines_after_class_opening' => true,
// There should not be blank lines between docblock and the documented element.
'no_blank_lines_after_phpdoc' => true,
// Remove useless semicolon statements.
'no_empty_statement' => true,
// Removes extra blank lines and/or blank lines following configuration.
'no_extra_consecutive_blank_lines' => true,
// Remove leading slashes in use clauses.
'no_leading_import_slash' => true,
// The namespace declaration line shouldn't contain leading whitespace.
'no_leading_namespace_whitespace' => true,
// Operator => should not be surrounded by multi-line whitespaces.
'no_multiline_whitespace_around_double_arrow' => true,
// Multi-line whitespace before closing semicolon are prohibited.
'no_multiline_whitespace_before_semicolons' => true,
// Replace short-echo <?= with long format <?php echo syntax.
'no_short_echo_tag' => true,
// Single-line whitespace before closing semicolon are prohibited.
'no_singleline_whitespace_before_semicolons' => true,
// Remove trailing commas in list function calls.
'no_trailing_comma_in_list_call' => true,
// PHP single-line arrays should not have trailing comma.
'no_trailing_comma_in_singleline_array' => true,
// Unused use statements must be removed.
'no_unused_imports' => true,
// Remove trailing whitespace at the end of blank lines.
'no_whitespace_in_blank_line' => true,
// Logical NOT operators (!) should have one trailing whitespace.
'not_operator_with_successor_space' => true,
// There should not be space before or after object T_OBJECT_OPERATOR ->.
'object_operator_without_whitespace' => true,
//Ordering use statements.
'ordered_imports' => [
'importsOrder' => null, // defines the order of import types
'sortAlgorithm' => 'length', // whether the statements should be sorted alphabetically or by length; defaults to 'alpha'
],
// Docblocks should have the same indentation as the documented subject.
'phpdoc_indent' => true,
// Fix phpdoc inline tags, make inheritdoc always inline.
'phpdoc_inline_tag' => true,
// @access annotations should be omitted from phpdocs.
'phpdoc_no_access' => true,
// @package and @subpackage annotations should be omitted from phpdocs.
'phpdoc_no_package' => true,
// Scalar types should always be written in the same form. int not integer, bool not boolean, float not real or double.
'phpdoc_scalar' => true,
// Phpdocs summary should end in either a full stop, exclamation mark, or question mark.
'phpdoc_summary' => true,
// Docblocks should only be used on structural elements.
'phpdoc_to_comment' => true,
// Phpdocs should start and end with content, excluding the very first and last line of the docblocks.
'phpdoc_trim' => true,
// @var and @type annotations should not contain the variable name.
'phpdoc_var_without_name' => true,
// Inside a classy element "self" should be preferred to the class name itself.
'self_accessor' => true,
// There should be exactly one blank line before a namespace declaration.
'single_blank_line_before_namespace' => true,
// Convert double quotes to single quotes for simple strings.
'single_quote' => true,
// Replace all <> with !=.
'standardize_not_equals' => true,
// Standardize spaces around ternary operator.
'ternary_operator_spaces' => true,
// PHP multi-line arrays should have a trailing comma.
'trailing_comma_in_multiline_array' => true,
// Arrays should be formatted like function/method arguments, without leading or trailing single line space.
'trim_array_spaces' => true,
// Unary operators should be placed adjacent to their operands.
'unary_operator_spaces' => true,
];
return PhpCsFixer\Config::create()
->setUsingCache(false)
->setRules($rules)
->setFinder(
PhpCsFixer\Finder::create()
->exclude(['bin', 'vendor'])
->in(__DIR__)
);