-
Notifications
You must be signed in to change notification settings - Fork 802
/
.php-cs-fixer.php
126 lines (115 loc) · 5.35 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
116
117
118
119
120
121
122
123
124
125
126
<?php
/**
* Shopware 5
* Copyright (c) shopware AG
*
* According to our licensing model, this program can be used
* under the terms of the GNU Affero General Public License, version 3.
*
* The texts of the GNU Affero General Public License with an additional
* permission can be found at and in the LICENSE file you have received
* along with this program.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* "Shopware" is a registered trademark of shopware AG.
* The licensing of the program under the AGPLv3 does not imply a
* trademark license. Therefore, any rights, title and interest in
* our trademarks remain entirely with the shopware AG.
*/
use PhpCsFixer\Config;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
use PhpCsFixerCustomFixers\Fixer\NoUselessCommentFixer;
use PhpCsFixerCustomFixers\Fixer\NoUselessDirnameCallFixer;
use PhpCsFixerCustomFixers\Fixer\NoUselessParenthesisFixer;
use PhpCsFixerCustomFixers\Fixer\NoUselessStrlenFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocNoIncorrectVarAnnotationFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocParamTypeFixer;
use PhpCsFixerCustomFixers\Fixer\PhpUnitAssertArgumentsOrderFixer;
use PhpCsFixerCustomFixers\Fixer\PhpUnitDedicatedAssertFixer;
use PhpCsFixerCustomFixers\Fixer\SingleSpaceAfterStatementFixer;
use PhpCsFixerCustomFixers\Fixer\SingleSpaceBeforeStatementFixer;
use PhpCsFixerCustomFixers\Fixers;
$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/_sql/migrations')
->in(__DIR__ . '/engine/Shopware')
->in(__DIR__ . '/tests')
->in(__DIR__ . '/recovery')
->in(__DIR__ . '/themes/Frontend/')
->exclude('Plugins/Community')
->exclude('Plugins/Local')
->exclude('install/templates')
->exclude('update/templates')
->notPath('LegacyPhpDumper.php')
->notPath('MemoryLimitTest.php');
$header = <<<EOF
Shopware 5
Copyright (c) shopware AG
According to our licensing model, this program can be used
under the terms of the GNU Affero General Public License, version 3.
The texts of the GNU Affero General Public License with an additional
permission can be found at and in the LICENSE file you have received
along with this program.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
"Shopware" is a registered trademark of shopware AG.
The licensing of the program under the AGPLv3 does not imply a
trademark license. Therefore, any rights, title and interest in
our trademarks remain entirely with the shopware AG.
EOF;
return (new Config())
->registerCustomFixers(new Fixers())
->setRiskyAllowed(true)
->setCacheFile('var/cache/php-cs-fixer')
->setParallelConfig(ParallelConfigFactory::detect())
->setRules([
'@PSR12' => true,
'@Symfony' => true,
'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one']],
'concat_space' => ['spacing' => 'one'],
'doctrine_annotation_indentation' => true,
'doctrine_annotation_spaces' => true,
'general_phpdoc_annotation_remove' => [
'annotations' => ['copyright', 'category'],
],
'global_namespace_import' => true,
'header_comment' => ['header' => $header, 'separate' => 'bottom', 'comment_type' => 'PHPDoc'],
'modernize_types_casting' => true,
'native_function_invocation' => ['exclude' => ['ini_get'], 'strict' => false],
'no_alias_functions' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_superfluous_phpdoc_tags' => true,
'nullable_type_declaration_for_default_null_value' => true,
'operator_linebreak' => ['only_booleans' => true],
'ordered_class_elements' => true,
'phpdoc_line_span' => true,
'phpdoc_order' => true,
'phpdoc_separation' => ['groups' => [['ORM\*', 'Assert\*', 'ShopwareAssert\*'], ['deprecated', 'link', 'see', 'since'], ['author', 'copyright', 'license'], ['category', 'package', 'subpackage'], ['property', 'property-read', 'property-write']]],
'phpdoc_summary' => false,
'phpdoc_var_annotation_correct_order' => true,
'php_unit_dedicate_assert' => true,
'php_unit_dedicate_assert_internal_type' => true,
'php_unit_construct' => true,
'php_unit_mock' => true,
'php_unit_mock_short_will_return' => true,
'php_unit_test_case_static_method_calls' => true,
'single_line_throw' => false,
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
NoUselessCommentFixer::name() => true,
SingleSpaceAfterStatementFixer::name() => true,
SingleSpaceBeforeStatementFixer::name() => true,
PhpdocParamTypeFixer::name() => true,
NoUselessStrlenFixer::name() => true,
NoUselessParenthesisFixer::name() => true,
PhpUnitDedicatedAssertFixer::name() => true,
PhpUnitAssertArgumentsOrderFixer::name() => true,
PhpdocNoIncorrectVarAnnotationFixer::name() => true,
NoUselessDirnameCallFixer::name() => true,
])
->setFinder($finder);