forked from mautic/mautic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
123 lines (104 loc) · 5.29 KB
/
Copy pathrector.php
File metadata and controls
123 lines (104 loc) · 5.29 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
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
<?php
declare(strict_types=1);
use Mautic\CoreBundle\Entity\CommonRepository;
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector;
use Utils\Rector\UnserializeToSerializerDecodeRector;
return RectorConfig::configure()
->withPaths([
__DIR__.'/app/bundles',
__DIR__.'/plugins',
])
->withPreparedSets(
deadCode: true,
typeDeclarations: true,
phpunitCodeQuality: true,
phpunitMockToStub: true,
phpunitNarrowAsserts: true,
privatization: true,
codeQuality: true,
)
->withPhpSets()
->withCache(__DIR__.'/var/cache/rector')
->withTypeGuardedClasses([
// common controllers
Mautic\CoreBundle\Controller\AbstractStandardFormController::class,
Mautic\CoreBundle\Controller\CommonController::class,
Mautic\CoreBundle\Controller\AbstractFormController::class,
Mautic\ApiBundle\Controller\CommonApiController::class,
Mautic\ApiBundle\Controller\FetchCommonApiController::class,
Mautic\PluginBundle\Integration\AbstractIntegration::class,
Mautic\LeadBundle\Controller\Api\CustomFieldsApiControllerTrait::class,
// other objects
CommonRepository::class,
Mautic\CoreBundle\Security\Permissions\AbstractPermissions::class,
MauticPlugin\MauticCrmBundle\Integration\CrmAbstractIntegration::class,
Mautic\PluginBundle\Integration\AbstractIntegration::class,
])
->withRules([
Rector\TypeDeclaration\Rector\StmtsAwareInterface\SafeDeclareStrictTypesRector::class,
Rector\PHPUnit\CodeQuality\Rector\ClassMethod\AssertClassToThisAssertRector::class,
Rector\TypeDeclarationDocblocks\Rector\Property\MergePhpstanDocTagIntoNativeRector::class,
Rector\Instanceof_\Rector\Ternary\FlipNegatedTernaryInstanceofRector::class,
Rector\TypeDeclarationDocblocks\Rector\ClassMethod\NarrowArrayCollectionUnionReturnDocblockRector::class,
UnserializeToSerializerDecodeRector::class,
// DI
Utils\Rector\ModelGetRepositoryToRepositoryServiceRector::class,
])
->reportUnusedSkips()
->withComposerBased(phpunit: true, symfony: true)
->withSkip([
// @todo move to "twig" group
Rector\Symfony\Symfony73\Rector\Class_\GetFiltersToAsTwigFilterAttributeRector::class,
Rector\Symfony\Symfony73\Rector\Class_\GetFunctionsToAsTwigFunctionAttributeRector::class,
// is deprecated, messy code
Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector::class,
// intentional parent property assign override
Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector::class => [
__DIR__.'/app/bundles/ApiBundle/Entity/oAuth2/Client.php',
],
// handle next
Rector\Symfony\CodeQuality\Rector\Class_\LoadValidatorMetadataToAttributeRector::class,
Rector\TypeDeclaration\Rector\StmtsAwareInterface\SafeDeclareStrictTypesRector::class,
Utils\Rector\ModelGetRepositoryToRepositoryServiceRector::class => [
__DIR__.'/app/bundles/PageBundle/Form/Type/PreferenceCenterListType.php',
],
// preference to compare null over object
Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector::class,
Rector\CodeQuality\Rector\Isset_\IssetOnPropertyObjectToPropertyExistsRector::class => [
// doctrine magic
__DIR__.'/app/bundles/CoreBundle/EventListener/DoctrineEventsSubscriber.php',
],
Rector\Symfony\Symfony30\Rector\ClassMethod\RemoveDefaultGetBlockPrefixRector::class,
// test fixtures
__DIR__.'/plugins/*/node_modules/*',
__DIR__.'/app/bundles/CoreBundle/Tests/Unit/Helper/resource/',
UnserializeToSerializerDecodeRector::class => [
// tests
__DIR__.'/app/bundles/UserBundle/Tests/Entity/UserTest.php',
],
// streamed response above
Rector\CodeQuality\Rector\ClassMethod\ExplicitReturnNullRector::class => [
__DIR__.'/app/bundles/ReportBundle/Model/ReportModel.php',
],
Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector::class => [
__DIR__.'/app/bundles/PageBundle/Controller/AjaxController.php',
__DIR__.'/app/bundles/EmailBundle/Controller/AjaxController.php',
],
// modified with reflection
Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class => [
__DIR__.'/app/bundles/EmailBundle/Entity/EmailDraft.php',
__DIR__.'/app/bundles/EmailBundle/Helper/MailHelper.php',
__DIR__.'/app/bundles/CoreBundle/Twig/Helper/DateHelper.php',
],
// Avoiding breaking BC breaks with forced return types in public methods
ReturnTypeFromReturnNewRector::class => [
__DIR__.'/app/bundles/IntegrationsBundle/Sync/SyncProcess/Direction/Integration/ObjectChangeGenerator.php',
__DIR__.'/app/bundles/IntegrationsBundle/Sync/SyncProcess/Direction/Internal/ObjectChangeGenerator.php',
],
Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector::class => [
// test fixture
__DIR__.'/app/bundles/CoreBundle/Tests/Unit/Doctrine/ArrayTypeTest.php',
],
])
->reportUnusedSkips();