-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathrector.php
More file actions
90 lines (76 loc) · 2.68 KB
/
rector.php
File metadata and controls
90 lines (76 loc) · 2.68 KB
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
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\FuncCall\SortCallLikeNamedArgsRector;
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector;
use Rector\CodingStyle\Rector\ClassLike\NewlineBetweenClassLikeStmtsRector;
use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
use Rector\CodingStyle\Rector\String_\SimplifyQuoteEscapeRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector;
use Rector\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector;
use Rector\TypeDeclarationDocblocks\Rector\ClassMethod\DocblockGetterReturnArrayFromPropertyDocblockVarRector;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
// @see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md for more rules
return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/examples',
])
->withRootFiles()
->withRules([
DeclareStrictTypesRector::class,
])
->withSkip([
// better explicit readability
FlipTypeControlToUseExclusiveTypeRector::class,
IfIssetToCoalescingRector::class,
SimplifyUselessVariableRector::class,
SimplifyIfReturnBoolRector::class,
// not all rules from code style
NewlineAfterStatementRector::class,
NewlineBeforeNewAssignSetRector::class,
NewlineBetweenClassLikeStmtsRector::class,
SimplifyQuoteEscapeRector::class,
// rely on types from interfaces
DocblockGetterReturnArrayFromPropertyDocblockVarRector::class,
// better readability using function declaration sorting
SortCallLikeNamedArgsRector::class,
// explicit testing private properties
RemoveUnusedPrivatePropertyRector::class => [
'tests/ConverterTest.php',
],
])
// tab-based indenting
->withIndent(indentChar: "\t", indentSize: 1)
// importing FQNs
->withImportNames(importShortClasses: false)
// lowest supported php version
->withPhpSets(php82: true)
// expand with new keys
->withPreparedSets(
deadCode: true,
codeQuality: true,
codingStyle: true,
typeDeclarations: true,
typeDeclarationDocblocks: true,
privatization: true,
phpunitCodeQuality: true,
// prefer own style
// naming: true,
// instanceOf: true,
// earlyReturn: true,
// rectorPreset: true,
// not used
// carbon: true,
// doctrineCodeQuality: true,
// symfonyCodeQuality: true,
// symfonyConfigs: true,
)
// vendor sets
->withAttributesSets()
->withComposerBased(phpunit: true)
;