|
2 | 2 |
|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
5 | | -use PHPStan\Type\ObjectType; |
6 | 5 | use Rector\Config\RectorConfig; |
7 | | -use Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector; |
8 | | -use Rector\Renaming\Rector\MethodCall\RenameMethodRector; |
9 | | -use Rector\Renaming\Rector\PropertyFetch\RenamePropertyRector; |
10 | | -use Rector\Renaming\ValueObject\MethodCallRename; |
11 | | -use Rector\Renaming\ValueObject\RenameClassAndConstFetch; |
12 | | -use Rector\Renaming\ValueObject\RenameProperty; |
13 | 6 | use Rector\Symfony\Set\SymfonySetList; |
14 | | -use Rector\Symfony\Symfony52\Rector\MethodCall\DefinitionAliasSetPrivateToSetPublicRector; |
15 | | -use Rector\Symfony\Symfony52\Rector\MethodCall\FormBuilderSetDataMapperRector; |
16 | | -use Rector\Symfony\Symfony52\Rector\MethodCall\ReflectionExtractorEnableMagicCallExtractorRector; |
17 | | -use Rector\Symfony\Symfony52\Rector\MethodCall\ValidatorBuilderEnableAnnotationMappingRector; |
18 | | -use Rector\Symfony\Symfony52\Rector\New_\PropertyAccessorCreationBooleanToFlagsRector; |
19 | | -use Rector\Symfony\Symfony52\Rector\New_\PropertyPathMapperToDataMapperRector; |
20 | | -use Rector\Symfony\Symfony52\Rector\StaticCall\BinaryFileResponseCreateToNewInstanceRector; |
21 | | -use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector; |
22 | | -use Rector\TypeDeclaration\ValueObject\AddParamTypeDeclaration; |
23 | 7 |
|
24 | 8 | # https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md |
25 | 9 |
|
26 | 10 | return static function (RectorConfig $rectorConfig): void { |
27 | | - $rectorConfig->sets([SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES]); |
| 11 | + // $rectorConfig->sets([SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES]); |
| 12 | + |
| 13 | + $rectorConfig->import(__DIR__ . '/symfony52/symfony52-dependency-injection.php'); |
| 14 | + $rectorConfig->import(__DIR__ . '/symfony52/symfony52-forms.php'); |
| 15 | + $rectorConfig->import(__DIR__ . '/symfony52/symfony52-http-foundation.php'); |
| 16 | + $rectorConfig->import(__DIR__ . '/symfony52/symfony52-http-kernel.php'); |
| 17 | + $rectorConfig->import(__DIR__ . '/symfony52/symfony52-mime.php'); |
| 18 | + $rectorConfig->import(__DIR__ . '/symfony52/symfony52-notifier.php'); |
| 19 | + $rectorConfig->import(__DIR__ . '/symfony52/symfony52-property-access.php'); |
| 20 | + $rectorConfig->import(__DIR__ . '/symfony52/symfony52-property-info.php'); |
| 21 | + $rectorConfig->import(__DIR__ . '/symfony52/symfony52-security-core.php'); |
| 22 | + $rectorConfig->import(__DIR__ . '/symfony52/symfony52-security-http.php'); |
| 23 | + $rectorConfig->import(__DIR__ . '/symfony52/symfony52-validator.php'); |
28 | 24 |
|
29 | | - $rectorConfig->rules([ |
30 | | - // https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#form |
31 | | - PropertyPathMapperToDataMapperRector::class, |
32 | | - |
33 | | - // https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#httpfoundation |
34 | | - BinaryFileResponseCreateToNewInstanceRector::class, |
35 | | - |
36 | | - // https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#propertyaccess |
37 | | - PropertyAccessorCreationBooleanToFlagsRector::class, |
38 | | - |
39 | | - // https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#propertyinfo |
40 | | - ReflectionExtractorEnableMagicCallExtractorRector::class, |
41 | | - |
42 | | - # https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#dependencyinjection |
43 | | - DefinitionAliasSetPrivateToSetPublicRector::class, |
44 | | - |
45 | | - # https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#form |
46 | | - FormBuilderSetDataMapperRector::class, |
47 | | - |
48 | | - # https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#validator |
49 | | - ValidatorBuilderEnableAnnotationMappingRector::class, |
50 | | - ]); |
51 | | - |
52 | | - # https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#security |
53 | | - $rectorConfig->ruleWithConfiguration(RenameClassConstFetchRector::class, [ |
54 | | - new RenameClassAndConstFetch( |
55 | | - 'Symfony\Component\Security\Http\Firewall\AccessListener', |
56 | | - 'PUBLIC_ACCESS', |
57 | | - 'Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter', |
58 | | - 'PUBLIC_ACCESS' |
59 | | - ), |
60 | | - ]); |
61 | | - |
62 | | - $rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [ |
63 | | - # https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#mime |
64 | | - new MethodCallRename('Symfony\Component\Mime\Address', 'fromString', 'create'), |
65 | | - |
66 | | - new MethodCallRename( |
67 | | - 'Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken', |
68 | | - 'setProviderKey', |
69 | | - 'setFirewallName' |
70 | | - ), |
71 | | - new MethodCallRename( |
72 | | - 'Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken', |
73 | | - 'getProviderKey', |
74 | | - 'getFirewallName' |
75 | | - ), |
76 | | - new MethodCallRename( |
77 | | - 'Symfony\Component\Security\Core\Authentication\Token\RememberMeToken', |
78 | | - 'setProviderKey', |
79 | | - 'setFirewallName' |
80 | | - ), |
81 | | - new MethodCallRename( |
82 | | - 'Symfony\Component\Security\Core\Authentication\Token\RememberMeToken', |
83 | | - 'getProviderKey', |
84 | | - 'getFirewallName' |
85 | | - ), |
86 | | - new MethodCallRename( |
87 | | - 'Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken', |
88 | | - 'setProviderKey', |
89 | | - 'setFirewallName' |
90 | | - ), |
91 | | - new MethodCallRename( |
92 | | - 'Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken', |
93 | | - 'getProviderKey', |
94 | | - 'getFirewallName' |
95 | | - ), |
96 | | - new MethodCallRename( |
97 | | - 'Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken', |
98 | | - 'setProviderKey', |
99 | | - 'setFirewallName' |
100 | | - ), |
101 | | - new MethodCallRename( |
102 | | - 'Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken', |
103 | | - 'getProviderKey', |
104 | | - 'getFirewallName' |
105 | | - ), |
106 | | - new MethodCallRename( |
107 | | - 'Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler', |
108 | | - 'setProviderKey', |
109 | | - 'setFirewallName' |
110 | | - ), |
111 | | - new MethodCallRename( |
112 | | - 'Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler', |
113 | | - 'getProviderKey', |
114 | | - 'getFirewallName' |
115 | | - ), |
116 | | - ]); |
117 | | - |
118 | | - # https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#notifier |
119 | | - $rectorConfig->ruleWithConfiguration(AddParamTypeDeclarationRector::class, [ |
120 | | - new AddParamTypeDeclaration( |
121 | | - 'Symfony\Component\Notifier\NotifierInterface', |
122 | | - 'send', |
123 | | - 1, |
124 | | - new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface') |
125 | | - ), |
126 | | - new AddParamTypeDeclaration( |
127 | | - 'Symfony\Component\Notifier\Notifier', |
128 | | - 'getChannels', |
129 | | - 1, |
130 | | - new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface') |
131 | | - ), |
132 | | - new AddParamTypeDeclaration( |
133 | | - 'Symfony\Component\Notifier\Channel\ChannelInterface', |
134 | | - 'notify', |
135 | | - 1, |
136 | | - new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface') |
137 | | - ), |
138 | | - new AddParamTypeDeclaration( |
139 | | - 'Symfony\Component\Notifier\Channel\ChannelInterface', |
140 | | - 'supports', |
141 | | - 1, |
142 | | - new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface') |
143 | | - ), |
144 | | - new AddParamTypeDeclaration( |
145 | | - 'Symfony\Component\Notifier\Notification\ChatNotificationInterface', |
146 | | - 'asChatMessage', |
147 | | - 0, |
148 | | - new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface') |
149 | | - ), |
150 | | - new AddParamTypeDeclaration( |
151 | | - 'Symfony\Component\Notifier\Notification\EmailNotificationInterface', |
152 | | - 'asEmailMessage', |
153 | | - 0, |
154 | | - new ObjectType('Symfony\Component\Notifier\Recipient\EmailRecipientInterface') |
155 | | - ), |
156 | | - new AddParamTypeDeclaration( |
157 | | - 'Symfony\Component\Notifier\Notification\SmsNotificationInterface', |
158 | | - 'asSmsMessage', |
159 | | - 0, |
160 | | - new ObjectType('Symfony\Component\Notifier\Recipient\SmsRecipientInterface') |
161 | | - ), |
162 | | - ]); |
163 | | - |
164 | | - # https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#security |
165 | | - $rectorConfig->ruleWithConfiguration(RenamePropertyRector::class, [ |
166 | | - new RenameProperty( |
167 | | - 'Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices', |
168 | | - 'providerKey', |
169 | | - 'firewallName' |
170 | | - ), |
171 | | - ]); |
172 | 25 | }; |
0 commit comments