Skip to content

Commit b7bb936

Browse files
authored
[symfony 5.4] split of configs per package (#739)
* [symfony 5.4] split of configs per package * [symfony 5.4] split of configs per package * add security-bundle * add security * add security * add cache * add http-kernel * add notifier * clean up
1 parent 269aaae commit b7bb936

8 files changed

Lines changed: 175 additions & 72 deletions

File tree

config/sets/symfony/symfony5/symfony54.php

Lines changed: 7 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -3,80 +3,16 @@
33
declare(strict_types=1);
44

55
use Rector\Config\RectorConfig;
6-
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
7-
use Rector\Php80\ValueObject\AnnotationToAttribute;
8-
use Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector;
9-
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
10-
use Rector\Renaming\Rector\Name\RenameClassRector;
11-
use Rector\Renaming\ValueObject\MethodCallRename;
12-
use Rector\Renaming\ValueObject\RenameClassAndConstFetch;
13-
use Rector\Renaming\ValueObject\RenameClassConstFetch;
14-
use Rector\Symfony\Set\SymfonySetList;
156

167
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.4.md
178

189
return static function (RectorConfig $rectorConfig): void {
19-
$rectorConfig->sets([SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES]);
10+
// $rectorConfig->sets([SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES]);
2011

21-
// @see https://symfony.com/blog/new-in-symfony-5-4-nested-validation-attributes
22-
// @see https://github.com/symfony/symfony/pull/41994
23-
$rectorConfig->ruleWithConfiguration(AnnotationToAttributeRector::class, [
24-
new AnnotationToAttribute('Symfony\Component\Validator\Constraints\All'),
25-
new AnnotationToAttribute('Symfony\Component\Validator\Constraints\Collection'),
26-
new AnnotationToAttribute('Symfony\Component\Validator\Constraints\AtLeastOneOf'),
27-
new AnnotationToAttribute('Symfony\Component\Validator\Constraints\Sequentially'),
28-
]);
29-
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
30-
// @see https://github.com/symfony/symfony/pull/42582
31-
new MethodCallRename(
32-
'Symfony\Bundle\SecurityBundle\Security\FirewallConfig',
33-
'getListeners',
34-
'getAuthenticators'
35-
),
36-
// @see https://github.com/symfony/symfony/pull/41754
37-
new MethodCallRename(
38-
'Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension',
39-
'addSecurityListenerFactory',
40-
'addAuthenticatorFactory'
41-
),
42-
]);
43-
44-
$rectorConfig->ruleWithConfiguration(RenameClassConstFetchRector::class, [
45-
new RenameClassAndConstFetch(
46-
'Symfony\Component\Security\Core\AuthenticationEvents',
47-
'AUTHENTICATION_SUCCESS',
48-
'Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent',
49-
'class'
50-
),
51-
new RenameClassAndConstFetch(
52-
'Symfony\Component\Security\Core\AuthenticationEvents',
53-
'AUTHENTICATION_FAILURE',
54-
'Symfony\Component\Security\Core\Event\AuthenticationFailureEvent',
55-
'class'
56-
),
57-
// @see https://github.com/symfony/symfony/pull/42510
58-
new RenameClassConstFetch(
59-
'Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter',
60-
'IS_ANONYMOUS',
61-
'PUBLIC_ACCESS'
62-
),
63-
new RenameClassConstFetch(
64-
'Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter',
65-
'IS_AUTHENTICATED_ANONYMOUSLY',
66-
'PUBLIC_ACCESS'
67-
),
68-
]);
69-
70-
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
71-
// @see https://github.com/symfony/symfony/pull/42050
72-
'Symfony\Component\Security\Http\Event\DeauthenticatedEvent' => 'Symfony\Component\Security\Http\Event\TokenDeauthenticatedEvent',
73-
// @see https://github.com/symfony/symfony/pull/42965
74-
'Symfony\Component\Cache\Adapter\DoctrineAdapter' => 'Doctrine\Common\Cache\Psr6\CacheAdapter',
75-
// @see https://github.com/symfony/symfony/pull/45615
76-
'Symfony\Component\HttpKernel\EventListener\AbstractTestSessionListener' => 'Symfony\Component\HttpKernel\EventListener\AbstractSessionListener',
77-
'Symfony\Component\HttpKernel\EventListener\TestSessionListener' => 'Symfony\Component\HttpKernel\EventListener\SessionListener',
78-
// @see https://github.com/symfony/symfony/pull/44271
79-
'Symfony\Component\Notifier\Bridge\Nexmo\NexmoTransportFactory' => 'Symfony\Component\Notifier\Bridge\Vonage\VonageTransportFactory',
80-
'Symfony\Component\Notifier\Bridge\Nexmo\NexmoTransport' => 'Symfony\Component\Notifier\Bridge\Vonage\VonageTransport',
81-
]);
12+
$rectorConfig->import(__DIR__ . '/symfony54/symfony54-validator.php');
13+
$rectorConfig->import(__DIR__ . '/symfony54/symfony54-security-bundle.php');
14+
$rectorConfig->import(__DIR__ . '/symfony54/symfony54-security.php');
15+
$rectorConfig->import(__DIR__ . '/symfony54/symfony54-cache.php');
16+
$rectorConfig->import(__DIR__ . '/symfony54/symfony54-http-kernel.php');
17+
$rectorConfig->import(__DIR__ . '/symfony54/symfony54-notifier.php');
8218
};
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\Renaming\Rector\Name\RenameClassRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
10+
// @see https://github.com/symfony/symfony/pull/42965
11+
'Symfony\Component\Cache\Adapter\DoctrineAdapter' => 'Doctrine\Common\Cache\Psr6\CacheAdapter',
12+
]);
13+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Renaming\Rector\Name\RenameClassRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
10+
// @see https://github.com/symfony/symfony/pull/45615
11+
'Symfony\Component\HttpKernel\EventListener\AbstractTestSessionListener' => 'Symfony\Component\HttpKernel\EventListener\AbstractSessionListener',
12+
'Symfony\Component\HttpKernel\EventListener\TestSessionListener' => 'Symfony\Component\HttpKernel\EventListener\SessionListener',
13+
]);
14+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Renaming\Rector\Name\RenameClassRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
10+
// @see https://github.com/symfony/symfony/pull/44271
11+
'Symfony\Component\Notifier\Bridge\Nexmo\NexmoTransportFactory' => 'Symfony\Component\Notifier\Bridge\Vonage\VonageTransportFactory',
12+
'Symfony\Component\Notifier\Bridge\Nexmo\NexmoTransport' => 'Symfony\Component\Notifier\Bridge\Vonage\VonageTransport',
13+
]);
14+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
// @see https://github.com/symfony/symfony/pull/42582
12+
new MethodCallRename(
13+
'Symfony\Bundle\SecurityBundle\Security\FirewallConfig',
14+
'getListeners',
15+
'getAuthenticators'
16+
),
17+
// @see https://github.com/symfony/symfony/pull/41754
18+
new MethodCallRename(
19+
'Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension',
20+
'addSecurityListenerFactory',
21+
'addAuthenticatorFactory'
22+
),
23+
]);
24+
};
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector;
7+
use Rector\Renaming\Rector\Name\RenameClassRector;
8+
use Rector\Renaming\ValueObject\RenameClassAndConstFetch;
9+
use Rector\Renaming\ValueObject\RenameClassConstFetch;
10+
11+
return static function (RectorConfig $rectorConfig): void {
12+
$rectorConfig->ruleWithConfiguration(RenameClassConstFetchRector::class, [
13+
new RenameClassAndConstFetch(
14+
'Symfony\Component\Security\Core\AuthenticationEvents',
15+
'AUTHENTICATION_SUCCESS',
16+
'Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent',
17+
'class'
18+
),
19+
new RenameClassAndConstFetch(
20+
'Symfony\Component\Security\Core\AuthenticationEvents',
21+
'AUTHENTICATION_FAILURE',
22+
'Symfony\Component\Security\Core\Event\AuthenticationFailureEvent',
23+
'class'
24+
),
25+
// @see https://github.com/symfony/symfony/pull/42510
26+
new RenameClassConstFetch(
27+
'Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter',
28+
'IS_ANONYMOUS',
29+
'PUBLIC_ACCESS'
30+
),
31+
new RenameClassConstFetch(
32+
'Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter',
33+
'IS_AUTHENTICATED_ANONYMOUSLY',
34+
'PUBLIC_ACCESS'
35+
),
36+
]);
37+
38+
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
39+
// @see https://github.com/symfony/symfony/pull/42050
40+
'Symfony\Component\Security\Http\Event\DeauthenticatedEvent' => 'Symfony\Component\Security\Http\Event\TokenDeauthenticatedEvent',
41+
]);
42+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
7+
use Rector\Php80\ValueObject\AnnotationToAttribute;
8+
9+
return static function (RectorConfig $rectorConfig): void {
10+
// @see https://symfony.com/blog/new-in-symfony-5-4-nested-validation-attributes
11+
// @see https://github.com/symfony/symfony/pull/41994
12+
$rectorConfig->ruleWithConfiguration(AnnotationToAttributeRector::class, [
13+
new AnnotationToAttribute('Symfony\Component\Validator\Constraints\All'),
14+
new AnnotationToAttribute('Symfony\Component\Validator\Constraints\Collection'),
15+
new AnnotationToAttribute('Symfony\Component\Validator\Constraints\AtLeastOneOf'),
16+
new AnnotationToAttribute('Symfony\Component\Validator\Constraints\Sequentially'),
17+
]);
18+
};

src/Set/SetProvider/Symfony5SetProvider.php

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,52 @@ public function provide(): array
251251

252252
new ComposerTriggeredSet(
253253
SetGroup::SYMFONY,
254-
'symfony/*',
254+
'symfony/symfony',
255255
'5.4',
256256
__DIR__ . '/../../../config/sets/symfony/symfony5/symfony54.php'
257257
),
258+
259+
new ComposerTriggeredSet(
260+
SetGroup::SYMFONY,
261+
'symfony/validator',
262+
'5.4',
263+
__DIR__ . '/../../../config/sets/symfony/symfony5/symfony54/symfony54-validator.php'
264+
),
265+
266+
new ComposerTriggeredSet(
267+
SetGroup::SYMFONY,
268+
'symfony/security-bundle',
269+
'5.4',
270+
__DIR__ . '/../../../config/sets/symfony/symfony5/symfony54/symfony54-security-bundle.php'
271+
),
272+
273+
new ComposerTriggeredSet(
274+
SetGroup::SYMFONY,
275+
'symfony/security-bundle',
276+
'5.4',
277+
__DIR__ . '/../../../config/sets/symfony/symfony5/symfony54/symfony54-security.php'
278+
),
279+
280+
new ComposerTriggeredSet(
281+
SetGroup::SYMFONY,
282+
'symfony/cache',
283+
'5.4',
284+
__DIR__ . '/../../../config/sets/symfony/symfony5/symfony54/symfony54-cache.php'
285+
),
286+
287+
new ComposerTriggeredSet(
288+
SetGroup::SYMFONY,
289+
'symfony/http-kernel',
290+
'5.4',
291+
__DIR__ . '/../../../config/sets/symfony/symfony5/symfony54/symfony54-http-kernel.php'
292+
),
293+
294+
new ComposerTriggeredSet(
295+
SetGroup::SYMFONY,
296+
'symfony/notifier',
297+
'5.4',
298+
__DIR__ . '/../../../config/sets/symfony/symfony5/symfony54/symfony54-notifier.php'
299+
),
258300
];
259301
}
260302
}

0 commit comments

Comments
 (0)