-
Notifications
You must be signed in to change notification settings - Fork 9
/
.php_cs
96 lines (93 loc) · 3.55 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
<?php
/**
* Rule set to use.
*
* @see https://github.com/FriendsOfPHP/PHP-CS-Fixer
* @see https://mlocati.github.io/php-cs-fixer-configurator/
*/
$rules = [
// Use PSR2 preset
'@PSR2' => true,
// Each line of multi-line DocComments must have an asterisk [PSR-5] and must be aligned with the first one.
'align_multiline_comment' => [
'comment_type' => 'phpdocs_like',
],
// PHP arrays should be declared using the configured syntax.
'array_syntax' => [
'syntax' => 'short',
],
// Binary operators should be surrounded by space as configured.
'binary_operator_spaces' => [
'default' => 'single_space',
],
// 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 must precede any configured statement.
'blank_line_before_statement' => [
'statements' => [
// 'break',
// 'continue',
// 'declare',
'return',
'throw',
'try',
],
],
// Equal sign in declare statement should be surrounded by spaces or not following configuration.
'declare_equal_normalize' => [
'space' => 'single',
],
// Single line comments should use double slashes `//` and not hash `#`.
'hash_to_slash_comment' => true,
// Convert `heredoc` to `nowdoc` where possible.
'heredoc_to_nowdoc' => true,
// There should not be empty PHPDoc blocks.
'no_empty_phpdoc' => true,
// There should not be blank lines between docblock and the documented element.
'no_blank_lines_after_phpdoc' => true,
// Multi-line whitespace before closing semicolon are prohibited.
'no_multiline_whitespace_before_semicolons' => true,
// Short cast `bool` using double exclamation mark should not be used.
'no_short_bool_cast' => true,
// Replace short-echo `<?=` with long format `<?php echo` syntax.
'no_short_echo_tag' => true,
// PHP single-line arrays should not have trailing comma.
'no_trailing_comma_in_singleline_array' => true,
'no_unused_imports' => true,
// Logical NOT operators (`!`) should have one trailing whitespace.
'not_operator_with_successor_space' => true,
// Phpdoc should contain @param for all params.
'phpdoc_add_missing_param_annotation' => true,
// Docblocks should have the same indentation as the documented subject.
'phpdoc_indent' => true,
// Annotations in phpdocs should be ordered so that param annotations come first, then throws annotations, then return annotations.
'phpdoc_order' => true,
// Phpdocs summary should end in either a full stop, exclamation mark, or question mark.
'phpdoc_summary' => 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,
// PHP multi-line arrays should have a trailing comma.
'trailing_comma_in_multiline_array' => true,
// Replace all `<>` with `!=`.
'standardize_not_equals' => true,
// Unary operators should be placed adjacent to their operands.
'unary_operator_spaces' => true,
];
$excludes = [
'bootstrap',
'devtools',
'node_modules',
'public',
'resources',
'storage',
'vendor',
];
return PhpCsFixer\Config::create()
->setRules($rules)
->setFinder(
PhpCsFixer\Finder::create()
->exclude($excludes)
->in(__DIR__)
);