Skip to content

Commit 293607e

Browse files
committed
[Symfony 6.2] Move symfony/security-core to security-http and security-bundle as target class/contant exists there
1 parent 8e4d32a commit 293607e

File tree

6 files changed

+51
-79
lines changed

6 files changed

+51
-79
lines changed

config/sets/symfony/symfony6/symfony62.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
new AnnotationToAttribute('Sensio\Bundle\FrameworkExtraBundle\Configuration\Template'),
2020
]);
2121

22-
$rectorConfig->import(__DIR__ . '/symfony62/symfony62-security-core.php');
22+
$rectorConfig->import(__DIR__ . '/symfony62/symfony62-security-bundle.php');
2323
$rectorConfig->import(__DIR__ . '/symfony62/symfony62-security-http.php');
2424
$rectorConfig->import(__DIR__ . '/symfony62/symfony62-mime.php');
2525
$rectorConfig->import(__DIR__ . '/symfony62/symfony62-http-kernel.php');
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
// https://symfony.com/blog/new-in-symfony-6-2-built-in-cache-security-template-and-doctrine-attributes
10+
$rectorConfig->ruleWithConfiguration(
11+
RenameClassRector::class,
12+
[
13+
// @see https://github.com/symfony/symfony/pull/46094
14+
'Symfony\Component\Security\Core\Security' => 'Symfony\Bundle\SecurityBundle\Security',
15+
],
16+
);
17+
};

config/sets/symfony/symfony6/symfony62/symfony62-security-core.php

Lines changed: 0 additions & 48 deletions
This file was deleted.

config/sets/symfony/symfony6/symfony62/symfony62-security-http.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
use Rector\Config\RectorConfig;
66
use Rector\Renaming\Rector\Name\RenameClassRector;
77
use Rector\Symfony\Symfony62\Rector\Class_\SecurityAttributeToIsGrantedAttributeRector;
8+
use Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector;
9+
use Rector\Renaming\ValueObject\RenameClassAndConstFetch;
810

911
return static function (RectorConfig $rectorConfig): void {
1012
$rectorConfig->rule(SecurityAttributeToIsGrantedAttributeRector::class);
@@ -16,4 +18,33 @@
1618
'Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted' => 'Symfony\Component\Security\Http\Attribute\IsGranted',
1719
],
1820
);
21+
22+
// @see https://github.com/symfony/symfony/pull/46094
23+
// @see https://github.com/symfony/symfony/pull/48554
24+
$rectorConfig->ruleWithConfiguration(RenameClassConstFetchRector::class, [
25+
new RenameClassAndConstFetch(
26+
'Symfony\Component\Security\Core\Security',
27+
'ACCESS_DENIED_ERROR',
28+
'Symfony\Component\Security\Http\SecurityRequestAttributes',
29+
'ACCESS_DENIED_ERROR'
30+
),
31+
new RenameClassAndConstFetch(
32+
'Symfony\Component\Security\Core\Security',
33+
'AUTHENTICATION_ERROR',
34+
'Symfony\Component\Security\Http\SecurityRequestAttributes',
35+
'AUTHENTICATION_ERROR'
36+
),
37+
new RenameClassAndConstFetch(
38+
'Symfony\Component\Security\Core\Security',
39+
'LAST_USERNAME',
40+
'Symfony\Component\Security\Http\SecurityRequestAttributes',
41+
'LAST_USERNAME'
42+
),
43+
new RenameClassAndConstFetch(
44+
'Symfony\Component\Security\Core\Security',
45+
'MAX_USERNAME_LENGTH',
46+
'Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge',
47+
'MAX_USERNAME_LENGTH'
48+
),
49+
]);
1950
};

rules-tests/Symfony51/Rector/ClassMethod/RouteCollectionBuilderToRoutingConfiguratorRector/Fixture/some_class.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/Set/SetProvider/Symfony6SetProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ public function provide(): array
200200
),
201201
new ComposerTriggeredSet(
202202
SetGroup::SYMFONY,
203-
'symfony/security-core',
203+
'symfony/security-bundle',
204204
'6.2',
205-
__DIR__ . '/../../../config/sets/symfony/symfony6/symfony62/symfony62-security-core.php'
205+
__DIR__ . '/../../../config/sets/symfony/symfony6/symfony62/symfony62-security-bundle.php'
206206
),
207207
new ComposerTriggeredSet(
208208
SetGroup::SYMFONY,

0 commit comments

Comments
 (0)