Skip to content

Commit fa31172

Browse files
committed
[symfony 5.2] split of configs per package
1 parent dd2d556 commit fa31172

13 files changed

Lines changed: 272 additions & 160 deletions

config/sets/symfony/symfony5/symfony52.php

Lines changed: 13 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -2,171 +2,24 @@
22

33
declare(strict_types=1);
44

5-
use PHPStan\Type\ObjectType;
65
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;
136
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;
237

248
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md
259

2610
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');
2824

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-
]);
17225
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Symfony\Symfony52\Rector\MethodCall\DefinitionAliasSetPrivateToSetPublicRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->rules([
10+
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#dependencyinjection
11+
DefinitionAliasSetPrivateToSetPublicRector::class,
12+
]);
13+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Symfony\Symfony52\Rector\MethodCall\FormBuilderSetDataMapperRector;
7+
use Rector\Symfony\Symfony52\Rector\New_\PropertyPathMapperToDataMapperRector;
8+
9+
// https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#form
10+
return static function (RectorConfig $rectorConfig): void {
11+
$rectorConfig->rules([PropertyPathMapperToDataMapperRector::class, FormBuilderSetDataMapperRector::class]);
12+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Symfony\Symfony52\Rector\StaticCall\BinaryFileResponseCreateToNewInstanceRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->rules([
10+
// https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#httpfoundation
11+
BinaryFileResponseCreateToNewInstanceRector::class,
12+
]);
13+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
7+
return static function (RectorConfig $rectorConfig): void {
8+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
7+
use Rector\Renaming\ValueObject\MethodCallRename;
8+
9+
// https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#form
10+
return static function (RectorConfig $rectorConfig): void {
11+
12+
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
13+
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#mime
14+
new MethodCallRename('Symfony\Component\Mime\Address', 'fromString', 'create'),
15+
]);
16+
};
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PHPStan\Type\ObjectType;
6+
use Rector\Config\RectorConfig;
7+
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
8+
use Rector\TypeDeclaration\ValueObject\AddParamTypeDeclaration;
9+
10+
return static function (RectorConfig $rectorConfig): void {
11+
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#notifier
12+
$rectorConfig->ruleWithConfiguration(AddParamTypeDeclarationRector::class, [
13+
new AddParamTypeDeclaration(
14+
'Symfony\Component\Notifier\NotifierInterface',
15+
'send',
16+
1,
17+
new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface')
18+
),
19+
new AddParamTypeDeclaration(
20+
'Symfony\Component\Notifier\Notifier',
21+
'getChannels',
22+
1,
23+
new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface')
24+
),
25+
new AddParamTypeDeclaration(
26+
'Symfony\Component\Notifier\Channel\ChannelInterface',
27+
'notify',
28+
1,
29+
new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface')
30+
),
31+
new AddParamTypeDeclaration(
32+
'Symfony\Component\Notifier\Channel\ChannelInterface',
33+
'supports',
34+
1,
35+
new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface')
36+
),
37+
new AddParamTypeDeclaration(
38+
'Symfony\Component\Notifier\Notification\ChatNotificationInterface',
39+
'asChatMessage',
40+
0,
41+
new ObjectType('Symfony\Component\Notifier\Recipient\RecipientInterface')
42+
),
43+
new AddParamTypeDeclaration(
44+
'Symfony\Component\Notifier\Notification\EmailNotificationInterface',
45+
'asEmailMessage',
46+
0,
47+
new ObjectType('Symfony\Component\Notifier\Recipient\EmailRecipientInterface')
48+
),
49+
new AddParamTypeDeclaration(
50+
'Symfony\Component\Notifier\Notification\SmsNotificationInterface',
51+
'asSmsMessage',
52+
0,
53+
new ObjectType('Symfony\Component\Notifier\Recipient\SmsRecipientInterface')
54+
),
55+
]);
56+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Symfony\Symfony52\Rector\New_\PropertyAccessorCreationBooleanToFlagsRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->rules([
10+
// https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#propertyaccess
11+
PropertyAccessorCreationBooleanToFlagsRector::class,
12+
]);
13+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Symfony\Symfony52\Rector\MethodCall\ReflectionExtractorEnableMagicCallExtractorRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->rules([
10+
// https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.2.md#propertyinfo
11+
ReflectionExtractorEnableMagicCallExtractorRector::class,
12+
]);
13+
};
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
7+
use Rector\Renaming\ValueObject\MethodCallRename;
8+
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
11+
new MethodCallRename(
12+
'Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken',
13+
'setProviderKey',
14+
'setFirewallName'
15+
),
16+
new MethodCallRename(
17+
'Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken',
18+
'getProviderKey',
19+
'getFirewallName'
20+
),
21+
new MethodCallRename(
22+
'Symfony\Component\Security\Core\Authentication\Token\RememberMeToken',
23+
'setProviderKey',
24+
'setFirewallName'
25+
),
26+
new MethodCallRename(
27+
'Symfony\Component\Security\Core\Authentication\Token\RememberMeToken',
28+
'getProviderKey',
29+
'getFirewallName'
30+
),
31+
new MethodCallRename(
32+
'Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken',
33+
'setProviderKey',
34+
'setFirewallName'
35+
),
36+
new MethodCallRename(
37+
'Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken',
38+
'getProviderKey',
39+
'getFirewallName'
40+
),
41+
new MethodCallRename(
42+
'Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken',
43+
'setProviderKey',
44+
'setFirewallName'
45+
),
46+
new MethodCallRename(
47+
'Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken',
48+
'getProviderKey',
49+
'getFirewallName'
50+
),
51+
]);
52+
53+
};

0 commit comments

Comments
 (0)