-
Notifications
You must be signed in to change notification settings - Fork 0
/
.php-cs-fixer.php
115 lines (112 loc) · 3.48 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
<?php
$finder = PhpCsFixer\Finder::create()
->exclude('bootstrap/cache')
->exclude('storage')
->exclude('vendor')
->exclude('bower_components')
->exclude('resources/assets')
->exclude('public')
->exclude('node_modules')
->exclude('_ide_helper.php')
->in(__DIR__)
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PSR12' => true,
'phpdoc_no_empty_return' => false,
'phpdoc_var_annotation_correct_order' => true,
'array_syntax' => [
'syntax' => 'short',
],
'no_singleline_whitespace_before_semicolons' => true,
'no_extra_blank_lines' => [
'tokens' => [
'break', 'case', 'continue', 'curly_brace_block',
'default','extra', 'parenthesis_brace_block',
'return','square_brace_block', 'switch', 'throw',
'use', 'use_trait',
],
],
'cast_spaces' => [
'space' => 'single',
],
'concat_space' => [
'spacing' => 'one',
],
'single_quote' => true,
'lowercase_cast' => true,
'lowercase_static_reference' => true,
'no_empty_phpdoc' => true,
'no_empty_comment' => true,
'array_indentation' => true,
'short_scalar_cast' => true,
'no_mixed_echo_print' => [
'use' => 'echo',
],
'ordered_imports' => [
'sort_algorithm' => 'length',
],
'no_unused_imports' => true,
'binary_operator_spaces' => [
'default' => 'single_space',
],
'no_empty_statement' => true,
'unary_operator_spaces' => true, // $number ++ becomes $number++
'single_line_comment_style' => ['comment_types' => ['hash']], // # becomes //
'standardize_not_equals' => true, // <> becomes !=
'native_function_casing' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'declare_equal_normalize' => [
'space' => 'single',
],
'function_typehint_space' => true,
'no_leading_import_slash' => true,
'blank_line_before_statement' => [
'statements' => [
'break', 'case', 'continue',
'declare', 'default', 'do',
'exit', 'for', 'foreach',
'goto', 'if', 'include',
'include_once', 'require', 'require_once',
'return', 'switch', 'throw', 'try', 'while', 'yield',
],
],
'combine_consecutive_unsets' => true,
'method_chaining_indentation' => true,
'no_whitespace_in_blank_line' => true,
'blank_line_after_opening_tag' => true,
'no_trailing_comma_in_list_call' => true,
'list_syntax' => ['syntax' => 'short'],
'compact_nullable_typehint' => true,
'explicit_string_variable' => true,
'no_leading_namespace_whitespace' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'not_operator_with_successor_space' => true,
'object_operator_without_whitespace' => true,
'single_blank_line_before_namespace' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_whitespace_before_comma_in_array' => true,
'no_trailing_comma_in_singleline_array' => true,
'whitespace_after_comma_in_array' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'no_multiline_whitespace_around_double_arrow' => true,
'no_useless_return' => true,
'phpdoc_add_missing_param_annotation' => false,
'phpdoc_order' => true,
'phpdoc_scalar' => false,
'phpdoc_separation' => false,
'phpdoc_single_line_var_spacing' => false,
'single_trait_insert_per_statement' => true,
'return_type_declaration' => [
'space_before' => 'none',
],
])
->setFinder($finder)
->setLineEnding("\n");