forked from rectorphp/rector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecs.php
97 lines (83 loc) · 3.74 KB
/
ecs.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
<?php
declare(strict_types=1);
use PHP_CodeSniffer\Standards\PSR2\Sniffs\Methods\MethodDeclarationSniff;
use PhpCsFixer\Fixer\Import\GlobalNamespaceImportFixer;
use PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer;
use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocAnnotationRemoveFixer;
use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocTypesFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer;
use PhpCsFixer\Fixer\ReturnNotation\ReturnAssignmentFixer;
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\CodingStandard\Fixer\ArrayNotation\StandaloneLineInMultilineArrayFixer;
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
use Symplify\CodingStandard\Sniffs\Debug\CommentedOutCodeSniff;
use Symplify\EasyCodingStandard\Configuration\Option;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(StandaloneLineInMultilineArrayFixer::class);
$services->set(LineLengthFixer::class);
$services->set(GeneralPhpdocAnnotationRemoveFixer::class)
->call('configure', [[
'annotations' => ['throws', 'author', 'package', 'group'],
]]);
$services->set(LineLengthFixer::class);
$services->set(NoSuperfluousPhpdocTagsFixer::class)
->call('configure', [[
'allow_mixed' => true,
]]);
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/bin',
__DIR__ . '/src',
__DIR__ . '/packages',
__DIR__ . '/rules',
__DIR__ . '/tests',
__DIR__ . '/utils',
__DIR__ . '/compiler',
__DIR__ . '/config',
__DIR__ . '/ecs.php',
__DIR__ . '/rector.php',
__DIR__ . '/rector-ci.php',
__DIR__ . '/config/set',
]);
$parameters->set(Option::SETS, [
SetList::PSR_12,
SetList::PHP_70,
SetList::PHP_71,
SetList::SYMPLIFY,
SetList::COMMON,
SetList::CLEAN_CODE,
]);
$parameters->set(Option::EXCLUDE_PATHS, [
'*/Source/*',
'*/Fixture/*', '*/Expected/*',
# generated from /vendor
__DIR__ . '/packages/doctrine-annotation-generated/src/ConstantPreservingDocParser.php',
__DIR__ . '/packages/doctrine-annotation-generated/src/ConstantPreservingAnnotationReader.php',
// template files
__DIR__ . '/packages/rector-generator/templates/*',
]);
$parameters->set(Option::SKIP, [
GlobalNamespaceImportFixer::class => null,
MethodDeclarationSniff::class . '.Underscore' => null,
PhpdocTypesFixer::class => [__DIR__ . '/rules/php74/src/Rector/Double/RealToFloatTypeCastRector.php'],
CommentedOutCodeSniff::class . '.Found' => [
__DIR__ . '/rules/php72/src/Rector/Assign/ListEachRector.php',
__DIR__ . '/rules/dead-code/src/Rector/FunctionLike/RemoveOverriddenValuesRector.php',
__DIR__ . '/rules/php-spec-to-phpunit/src/Rector/MethodCall/PhpSpecPromisesToPHPUnitAssertRector.php',
],
PhpUnitStrictFixer::class => [
__DIR__ . '/packages/better-php-doc-parser/tests/PhpDocInfo/PhpDocInfo/PhpDocInfoTest.php',
__DIR__ . '/tests/PhpParser/Node/NodeFactoryTest.php',
'*TypeResolverTest.php',
],
UnaryOperatorSpacesFixer::class => null,
// breaks on-purpose annotated variables
ReturnAssignmentFixer::class => null,
StrictComparisonFixer::class => [__DIR__ . '/rules/polyfill/src/ConditionEvaluator.php'],
]);
$parameters->set(Option::LINE_ENDING, "\n");
};