8000 [symfony 64] split of configs per package (#747) · JohJohan/rector-symfony@3d3cfd9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d3cfd9

Browse files
authored
[symfony 64] split of configs per package (rectorphp#747)
* [symfony 64] split of configs per package * add form * add http-foundation * add error-handler
1 parent 9b78b8b commit 3d3cfd9

File tree

6 files changed

+101
-34
lines changed

6 files changed

+101
-34
lines changed

config/sets/symfony/symfony6/symfony64.php

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,12 @@
22

33
declare(strict_types=1);
44

5-
use PHPStan\Type\MixedType;
65
use Rector\Config\RectorConfig;
7-
use Rector\Renaming\Rector\Class_\RenameAttributeRector;
8-
use Rector\Renaming\Rector\Name\RenameClassRector;
9-
use Rector\Renaming\ValueObject\RenameAttribute;
10-
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
11-
use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration;
126

137
// @see https://github.com/symfony/symfony/blob/6.4/UPGRADE-6.4.md
148
return static function (RectorConfig $rectorConfig): void {
15-
$rectorConfig->ruleWithConfiguration(
16-
RenameClassRector::class,
17-
[
18-
'Symfony\Component\HttpKernel\UriSigner' => 'Symfony\Component\HttpFoundation\UriSigner',
19-
'Symfony\Component\HttpKernel\Debug\FileLinkFormatter' => 'Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter',
20-
],
21-
);
22-
23-
$rectorConfig->ruleWithConfiguration(RenameAttributeRector::class, [
24-
new RenameAttribute(
25-
'Symfony\Component\Routing\Annotation\Route',
26-
'Symfony\Component\Routing\Attribute\Route'
27-
),
28-
]);
29-
30-
$rectorConfig->ruleWithConfiguration(AddReturnTypeDeclarationRector::class, [
31-
new AddReturnTypeDeclaration(
32-
'Symfony\Component\Form\DataTransformerInterface',
33-
'transform',
34-
new MixedType(),
35-
),
36-
new AddReturnTypeDeclaration(
37-
'Symfony\Component\Form\DataTransformerInterface',
38-
'reverseTransform',
39-
new MixedType(),
40-
),
41-
]);
9+
$rectorConfig->import(__DIR__ . '/symfony64/symfony64-routing.php');
10+
$rectorConfig->import(__DIR__ . '/symfony64/symfony64-form.php');
11+
$rectorConfig->import(__DIR__ . '/symfony64/symfony64-http-foundation.php');
12+
$rectorConfig->import(__DIR__ . '/symfony64/symfony64-error-handler.php');
4213
};
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\Name\RenameClassRector;
7+
8+
// @see https://github.com/symfony/symfony/blob/6.4/UPGRADE-6.4.md
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->ruleWithConfiguration(
11+
RenameClassRector::class,
12+
[
13+
'Symfony\Component\HttpKernel\Debug\FileLinkFormatter' => 'Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter',
14+
],
15+
);
16+
};
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 PHPStan\Type\MixedType;
6+
use Rector\Config\RectorConfig;
7+
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
8+
use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration;
9+
10+
// @see https://github.com/symfony/symfony/blob/6.4/UPGRADE-6.4.md
11+
return static function (RectorConfig $rectorConfig): void {
12+
$rectorConfig->ruleWithConfiguration(AddReturnTypeDeclarationRector::class, [
13+
new AddReturnTypeDeclaration(
14+
'Symfony\Component\Form\DataTransformerInterface',
15+
'transform',
16+
new MixedType(),
17+
),
18+
new AddReturnTypeDeclaration(
19+
'Symfony\Component\Form\DataTransformerInterface',
20+
'reverseTransform',
21+
new MixedType(),
22+
),
23+
]);
24+
};
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\Name\RenameClassRector;
7+
8+
// @see https://github.com/symfony/symfony/blob/6.4/UPGRADE-6.4.md
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->ruleWithConfiguration(
11+
RenameClassRector::class,
12+
[
13+
'Symfony\Component\HttpKernel\UriSigner' => 'Symfony\Component\HttpFoundation\UriSigner',
14+
],
15+
);
16+
};
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\Class_\RenameAttributeRector;
7+
use Rector\Renaming\ValueObject\RenameAttribute;
8+
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->ruleWithConfiguration(RenameAttributeRector::class, [
11+
new RenameAttribute(
12+
'Symfony\Component\Routing\Annotation\Route',
13+
'Symfony\Component\Routing\Attribute\Route'
14+
),
15+
]);
16+
};

src/Set/SetProvider/Symfony6SetProvider.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,34 @@ public function provide(): array
207207

208208
new ComposerTriggeredSet(
209209
SetGroup::SYMFONY,
210-
'symfony/*',
210+
'symfony/symfony',
211211
'6.4',
212212
__DIR__ . '/../../../config/sets/symfony/symfony6/symfony64.php'
213213
),
214+
new ComposerTriggeredSet(
215+
SetGroup::SYMFONY,
216+
'symfony/routing',
217+
'6.4',
218+
__DIR__ . '/../../../config/sets/symfony/symfony6/symfony64/symfony64-routing.php'
219+
),
220+
new ComposerTriggeredSet(
221+
SetGroup::SYMFONY,
222+
'symfony/form',
223+
'6.4',
224+
__DIR__ . '/../../../config/sets/symfony/symfony6/symfony64/symfony64-form.php'
225+
),
226+
new ComposerTriggeredSet(
227+
SetGroup::SYMFONY,
228+
'symfony/http-foundation',
229+
'6.4',
230+
__DIR__ . '/../../../config/sets/symfony/symfony6/symfony64/symfony64-http-foundation.php'
231+
),
232+
new ComposerTriggeredSet(
233+
SetGroup::SYMFONY,
234+
'symfony/error-handler',
235+
'6.4',
236+
__DIR__ . '/../../../config/sets/symfony/symfony6/symfony64/symfony64-error-handler.php'
237+
),
214238
];
215239
}
216240
}

0 commit comments

Comments
 (0)
0