forked from good-php/serialization
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.php-cs-fixer.dist.php
124 lines (122 loc) · 4.24 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
$finder = PhpCsFixer\Finder::create()
->in('src')
->in('tests')
->name('*.php')
->notName('_*.php')
->ignoreVCS(true);
return (new PhpCsFixer\Config())
->setFinder($finder)
->setRiskyAllowed(true)
->setIndent("\t")
->setRules([
'@PhpCsFixer' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'@PSR12' => true,
'@PSR12:risky' => true,
'assign_null_coalescing_to_coalesce_equal' => true,
'modernize_strpos' => true,
'empty_loop_condition' => true,
'declare_parentheses' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => [
'=>' => 'align_single_space_minimal',
],
],
'blank_line_before_statement' => [
'statements' => [
'break', 'continue', 'declare', 'default', 'do', 'while', 'for',
'foreach', 'goto', 'if', 'return', 'switch', 'throw', 'try', 'yield',
],
],
'braces' => [
'position_after_control_structures' => 'same',
'allow_single_line_anonymous_class_with_empty_body' => true,
],
'class_attributes_separation' => [
'elements' => ['method' => 'one', 'property' => 'one'],
],
'concat_space' => [
'spacing' => 'one',
],
'increment_style' => [
'style' => 'post',
],
'linebreak_after_opening_tag' => true,
'native_function_invocation' => false,
'ordered_class_elements' => [
'order' => [
'use_trait',
'constant_public', 'constant_protected', 'constant_private',
'property_static', 'property_public_static', 'property_protected_static', 'property_private_static',
'property_public', 'property_protected', 'property_private',
'construct', 'destruct', 'magic', 'phpunit',
'method_static', 'method_public_static', 'method_protected_static', 'method_private_static',
'method_public', 'method_protected', 'method_private',
],
],
'ordered_imports' => true,
'phpdoc_no_empty_return' => false,
'phpdoc_summary' => false,
'ternary_to_null_coalescing' => true,
'visibility_required' => [
'elements' => [
'const', 'property', 'method',
],
],
'yoda_style' => ['always_move_variable' => true, 'equal' => false, 'identical' => false],
'php_unit_test_class_requires_covers' => false,
'php_unit_internal_class' => false,
'protected_to_private' => false,
// Adds stupid semicolons on newlines
'multiline_whitespace_before_semicolons' => false,
// Doesn't work with "nested" chaining
'method_chaining_indentation' => true,
'mb_str_functions' => true,
'global_namespace_import' => true,
'list_syntax' => [
'syntax' => 'short',
],
'phpdoc_line_span' => [
'const' => 'single',
'property' => 'single',
],
'general_phpdoc_annotation_remove' => [
// We don't believe so called "checked exceptions" are a good design. We're following the logic of Kotlin:
// https://kotlinlang.org/docs/reference/exceptions.html#checked-exceptions
'annotations' => ['throws'],
],
'error_suppression' => [
// Mutes trigger_error() with E_USER_DEPRECATED, but we handle deprecations manually so this is needed.
'mute_deprecation_error' => false,
],
'operator_linebreak' => [
'only_booleans' => true,
'position' => 'end',
],
'native_constant_invocation' => false,
'simplified_if_return' => true,
'heredoc_indentation' => true,
'use_arrow_functions' => true,
'no_trailing_whitespace_in_string' => false,
'phpdoc_no_alias_tag' => [
// Default except property-read and property-write replacement
'replacements' => ['type' => 'var', 'link' => 'see'],
],
// Force {@inheritDoc} to @inheritDoc whenever possible.
'phpdoc_tag_type' => [
'tags' => [
'inheritDoc' => 'annotation',
],
],
// Rename lower case & plural form @inheritDoc
'general_phpdoc_tag_rename' => [
'replacements' => [
'inheritDocs' => 'inheritDoc',
'inheritdoc' => 'inheritDoc',
],
],
]);