This repository has been archived by the owner on Aug 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.php_cs
171 lines (167 loc) · 5.9 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php
$header = <<<'EOF'
(c)Copyright 2007-%s UGroupMedia Inc. <[email protected]>
This source file is part of PNP Project and is subject to
copyright. It can not be copied and/or distributed without
the express permission of UGroupMedia Inc.
If you get a copy of this file without explicit authorization,
please contact us to the email above.
EOF;
$header = sprintf($header, date('Y'));
$finder = PhpCsFixer\Finder::create()
->exclude('bin')
->exclude('tests')
->exclude('vendor')
->in(__DIR__);
$config = PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@PHPUnit60Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'@DoctrineAnnotation' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'declare_strict_types' => true,
'phpdoc_align' => [
'align' => 'left',
],
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
'blank_line_before_statement' => true,
'phpdoc_annotation_without_dot' => false,
'align_multiline_comment' => false,
'concat_space' => [
'spacing' => 'one',
],
'array_indentation' => true,
'array_syntax' => [
'syntax' => 'short',
],
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'comment_to_phpdoc' => true,
'compact_nullable_typehint' => true,
'escape_implicit_backslashes' => true,
'explicit_indirect_variable' => true,
'explicit_string_variable' => true,
'final_internal_class' => true,
'fully_qualified_strict_types' => true,
'function_to_constant' => [
'functions' => [
'get_class',
'get_called_class',
'php_sapi_name',
'phpversion',
'pi',
],
],
'header_comment' => [
'header' => $header,
],
'heredoc_to_nowdoc' => true,
'list_syntax' => [
'syntax' => 'short',
],
'logical_operators' => true,
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
],
'method_chaining_indentation' => true,
'multiline_comment_opening_closing' => true,
'native_function_invocation' => [
'include' => ['@compiler_optimized'],
'scope' => 'namespaced',
],
'no_alternative_syntax' => true,
'no_binary_string' => true,
'no_extra_blank_lines' => [
'break',
'case',
'continue',
'curly_brace_block',
'default',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'switch',
'throw',
'use',
'useTrait',
'use_trait',
],
'no_null_property_initialization' => true,
'no_short_echo_tag' => true,
'no_superfluous_elseif' => false,
'no_unreachable_default_argument_value' => true,
'no_unset_on_property' => false,
'no_useless_else' => false,
'ordered_imports' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types_order' => true,
'return_assignment' => true,
'string_line_ending' => true,
'increment_style' => false,
'class_attributes_separation' => [
'elements' => [
'method',
'property',
],
],
'fopen_flags' => [
'b_mode' => true,
],
// THIS could be nice if we can ad some exception like ID property always on top.
// 'ordered_class_elements' => [
// 'order' => [
// 'use_trait',
// 'public',
// 'protected',
// 'private',
// 'constant',
// 'constant_public',
// 'constant_protected',
// 'constant_private',
// 'property',
// 'property_static',
// 'property_public',
// 'property_protected',
// 'property_private',
// 'property_public_static',
// 'property_protected_static',
// 'property_private_static',
// 'construct',
// 'method',
// 'method_static',
// 'method_public',
// 'method_protected',
// 'method_private',
// 'method_public_static',
// 'method_protected_static',
// 'method_private_static',
// 'magic',
// 'destruct',
// 'phpunit',
// ],
// 'sortAlgorithm' => 'alpha'
// ],
// DONT ENABLE ALL THE TIME. DO TIME TO TIME CHECK WITH THOSE ENABLED
'strict_param' => false,
'strict_comparison' => false,
// FOLLOWING JUST CREATE TOO MUCH BREAKING FOR NOW.
//'php_unit_internal_class' => true,
//'php_unit_ordered_covers' => true,
//'php_unit_set_up_tear_down_visibility' => true,
//'php_unit_strict' => true,
//'php_unit_test_annotation' => true,
//'php_unit_test_case_static_method_calls' => ['call_type' => 'this'],
//'php_unit_test_class_requires_covers' => true,
])
->setFinder($finder);
return $config;