-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.php-cs-fixer.dist.php
134 lines (128 loc) · 4.43 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
125
126
127
128
129
130
131
132
133
134
<?php
declare(strict_types=1);
// @codeCoverageIgnoreStart
$header = <<<'HEADER'
DISCLAIMER.
Do not edit or add to this file if you wish to upgrade Gally to newer versions in the future.
@author Gally Team <[email protected]>
@copyright 2022-present Smile
@license Open Software License v. 3.0 (OSL-3.0)
HEADER;
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude([
'src/Acme',
'src/Core/Bridge/Symfony/Maker/Resources/skeleton',
'tests/Fixtures/app/var',
])
->notPath('#src\/Gally\/.*\/Legacy#')
->notPath('src/Symfony/Bundle/DependencyInjection/Configuration.php')
->notPath('src/Annotation/ApiFilter.php') // temporary
->notPath('src/Annotation/ApiProperty.php') // temporary
->notPath('src/Annotation/ApiResource.php') // temporary
->notPath('src/Annotation/ApiSubresource.php') // temporary
->notPath('src/Kernel.php') // temporary
->notPath('src/DataFixtures/AppFixtures.php') // file added by doctrine fixtures bundle
->notPath('tests/Fixtures/TestBundle/Entity/DummyPhp8.php'); // temporary
// ->append([
// 'tests/Fixtures/app/console',
// ]);
return (new PhpCsFixer\Config())
// ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) commented because this break header rule
->setRiskyAllowed(true)
->setRules([
'@DoctrineAnnotation' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'@PHPUnit60Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'align_multiline_comment' => [
'comment_type' => 'phpdocs_like',
],
'array_indentation' => true,
'compact_nullable_typehint' => true,
'concat_space' => [
'spacing' => 'one',
],
'doctrine_annotation_array_assignment' => [
'operator' => '=',
],
'doctrine_annotation_spaces' => [
'after_array_assignments_equals' => false,
'before_array_assignments_equals' => false,
],
'explicit_indirect_variable' => true,
'fully_qualified_strict_types' => true,
'header_comment' => [
'comment_type' => 'PHPDoc',
'header' => $header,
'location' => 'after_open',
'separate' => 'bottom',
],
'logical_operators' => true,
'multiline_comment_opening_closing' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'no_alternative_syntax' => true,
'no_extra_blank_lines' => [
'tokens' => [
'break',
'continue',
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'throw',
'use',
],
],
'no_superfluous_elseif' => true,
// To re-enable in API Platform 3: https://github.com/symfony/symfony/issues/43021
//'no_superfluous_phpdoc_tags' => [
// 'allow_mixed' => false,
//],
'no_unset_cast' => true,
'no_unset_on_property' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => [
'imports_order' => [
'class',
'function',
'const',
],
'sort_algorithm' => 'alpha',
],
'phpdoc_to_comment' => [
'ignored_tags' => ['var', 'todo'],
],
'php_unit_method_casing' => [
'case' => 'camel_case',
],
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_test_annotation' => [
'style' => 'prefix',
],
'phpdoc_add_missing_param_annotation' => [
'only_untyped' => true,
],
'phpdoc_no_alias_tag' => true,
'phpdoc_order' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_var_annotation_correct_order' => true,
'return_assignment' => true,
'strict_param' => true,
'visibility_required' => [
'elements' => [
'const',
'method',
'property',
],
],
'void_return' => false, // BC breaks; to be done in API Platform 3.0
])
->setFinder($finder);
// @codeCoverageIgnoreEnd