Skip to content

Commit 341c2e6

Browse files
authored
[symfony 4.4] split of symfony configs per package (#733)
* split SymfonySetProvider per versions * [symfony 4.4] Split of per package configs
1 parent 1734da9 commit 341c2e6

18 files changed

+767
-552
lines changed

config/sets/symfony/symfony4/symfony42/symfony42-finder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
declare(strict_types=1);
44

5+
use Rector\Arguments\NodeAnalyzer\ArgumentAddingScope;
56
use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector;
67
use Rector\Arguments\ValueObject\ArgumentAdder;
78
use Rector\Config\RectorConfig;
@@ -15,7 +16,7 @@
1516
null,
1617
false,
1718
null,
18-
\Rector\Arguments\NodeAnalyzer\ArgumentAddingScope::SCOPE_METHOD_CALL
19+
ArgumentAddingScope::SCOPE_METHOD_CALL
1920
),
2021
]);
2122
};

config/sets/symfony/symfony4/symfony42/symfony42-forms.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
declare(strict_types=1);
44

5+
use PHPStan\Type\IterableType;
6+
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
7+
use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration;
8+
use Rector\Visibility\Rector\ClassMethod\ChangeMethodVisibilityRector;
9+
use Rector\Visibility\ValueObject\ChangeMethodVisibility;
10+
use Rector\ValueObject\Visibility;
11+
use Rector\Transform\Rector\ClassMethod\WrapReturnRector;
12+
use Rector\Transform\ValueObject\WrapReturn;
513
use PHPStan\Type\MixedType;
614
use Rector\Config\RectorConfig;
715
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
@@ -12,12 +20,12 @@
1220
new MethodCallRename('Symfony\Component\Form\AbstractTypeExtension', 'getExtendedType', 'getExtendedTypes'),
1321
]);
1422

15-
$iterableType = new \PHPStan\Type\IterableType(new MixedType(), new MixedType());
23+
$iterableType = new IterableType(new MixedType(), new MixedType());
1624

1725
$rectorConfig->ruleWithConfiguration(
18-
\Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector::class,
26+
AddReturnTypeDeclarationRector::class,
1927
[
20-
new \Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration(
28+
new AddReturnTypeDeclaration(
2129
'Symfony\Component\Form\AbstractTypeExtension',
2230
'getExtendedTypes',
2331
$iterableType
@@ -26,19 +34,19 @@
2634
);
2735

2836
$rectorConfig->ruleWithConfiguration(
29-
\Rector\Visibility\Rector\ClassMethod\ChangeMethodVisibilityRector::class,
30-
[new \Rector\Visibility\ValueObject\ChangeMethodVisibility(
37+
ChangeMethodVisibilityRector::class,
38+
[new ChangeMethodVisibility(
3139
'Symfony\Component\Form\AbstractTypeExtension',
3240
'getExtendedTypes',
33-
\Rector\ValueObject\Visibility::STATIC
41+
Visibility::STATIC
3442
),
3543
]
3644
);
3745

3846
$rectorConfig->ruleWithConfiguration(
39-
\Rector\Transform\Rector\ClassMethod\WrapReturnRector::class,
47+
WrapReturnRector::class,
4048
[
41-
new \Rector\Transform\ValueObject\WrapReturn(
49+
new WrapReturn(
4250
'Symfony\Component\Form\AbstractTypeExtension',
4351
'getExtendedTypes',
4452
true

config/sets/symfony/symfony4/symfony43/symfony43-framework-bundle.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
declare(strict_types=1);
44

5+
use Rector\Symfony\Symfony43\Rector\MethodCall\ConvertRenderTemplateShortNotationToBundleSyntaxRector;
6+
use Rector\Symfony\Symfony43\Rector\MethodCall\WebTestCaseAssertIsSuccessfulRector;
7+
use Rector\Symfony\Symfony43\Rector\MethodCall\WebTestCaseAssertResponseCodeRector;
58
use Rector\Config\RectorConfig;
69
use Rector\Renaming\Rector\Name\RenameClassRector;
710

@@ -15,10 +18,10 @@
1518
]);
1619

1720
$rectorConfig->rules([
18-
\Rector\Symfony\Symfony43\Rector\MethodCall\ConvertRenderTemplateShortNotationToBundleSyntaxRector::class,
21+
ConvertRenderTemplateShortNotationToBundleSyntaxRector::class,
1922
# https://symfony.com/blog/new-in-symfony-4-3-better-test-assertions
2023
//
21-
\Rector\Symfony\Symfony43\Rector\MethodCall\WebTestCaseAssertIsSuccessfulRector::class,
22-
\Rector\Symfony\Symfony43\Rector\MethodCall\WebTestCaseAssertResponseCodeRector::class,
24+
WebTestCaseAssertIsSuccessfulRector::class,
25+
WebTestCaseAssertResponseCodeRector::class,
2326
]);
2427
};

config/sets/symfony/symfony4/symfony43/symfony43-twig-bundle.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
declare(strict_types=1);
44

5+
use Rector\Symfony\Symfony43\Rector\StmtsAwareInterface\TwigBundleFilesystemLoaderToTwigRector;
56
use Rector\Config\RectorConfig;
67

78
return static function (RectorConfig $rectorConfig): void {
89
$rectorConfig->rules([
9-
\Rector\Symfony\Symfony43\Rector\StmtsAwareInterface\TwigBundleFilesystemLoaderToTwigRector::class,
10+
TwigBundleFilesystemLoaderToTwigRector::class,
1011
]);
1112
};

config/sets/symfony/symfony4/symfony44.php

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,13 @@
33
declare(strict_types=1);
44

55
use Rector\Config\RectorConfig;
6-
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
7-
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
8-
use Rector\Renaming\Rector\Name\RenameClassRector;
9-
use Rector\Renaming\ValueObject\MethodCallRename;
10-
use Rector\Symfony\Symfony44\Rector\ClassMethod\ConsoleExecuteReturnIntRector;
11-
use Rector\Symfony\Symfony44\Rector\MethodCall\AuthorizationCheckerIsGrantedExtractorRector;
126

13-
# https://github.com/symfony/symfony/blob/4.4/UPGRADE-4.4.md
7+
// https://github.com/symfony/symfony/blob/4.4/UPGRADE-4.4.md
148

159
return static function (RectorConfig $rectorConfig): void {
16-
$rectorConfig->rules([
17-
// https://github.com/symfony/symfony/pull/33775
18-
ConsoleExecuteReturnIntRector::class,
19-
// https://github.com/symfony/symfony/blob/4.4/UPGRADE-4.4.md#security
20-
AuthorizationCheckerIsGrantedExtractorRector::class,
21-
]);
22-
23-
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
24-
'Symfony\Component\Templating\EngineInterface' => 'Twig\Environment',
25-
]);
26-
27-
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, [
28-
'Symfony\Component\DependencyInjection\Loader\Configurator\tagged' => 'Symfony\Component\DependencyInjection\Loader\Configurator\tagged_iterator',
29-
]);
30-
31-
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
32-
# https://github.com/symfony/http-kernel/blob/801b925e308518ddf821ba91952c41ae77c77507/Event/GetResponseForExceptionEvent.php#L55
33-
new MethodCallRename(
34-
'Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent',
35-
'getException',
36-
'getThrowable'
37-
),
38-
# https://github.com/symfony/http-kernel/blob/801b925e308518ddf821ba91952c41ae77c77507/Event/GetResponseForExceptionEvent.php#L67
39-
new MethodCallRename(
40-
'Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent',
41-
'setException',
42-
'setThrowable'
43-
),
44-
]);
10+
$rectorConfig->import(__DIR__ . '/symfony44/symfony44-dependency-injection.php');
11+
$rectorConfig->import(__DIR__ . '/symfony44/symfony44-console.php');
12+
$rectorConfig->import(__DIR__ . '/symfony44/symfony44-http-kernel.php');
13+
$rectorConfig->import(__DIR__ . '/symfony44/symfony44-templating.php');
14+
$rectorConfig->import(__DIR__ . '/symfony44/symfony44-security-core.php');
4515
};
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\Symfony44\Rector\ClassMethod\ConsoleExecuteReturnIntRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->rules([
10+
// https://github.com/symfony/symfony/pull/33775
11+
ConsoleExecuteReturnIntRector::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\Renaming\Rector\FuncCall\RenameFunctionRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, [
10+
'Symfony\Component\DependencyInjection\Loader\Configurator\tagged' => 'Symfony\Component\DependencyInjection\Loader\Configurator\tagged_iterator',
11+
]);
12+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
// https://github.com/symfony/http-kernel/blob/801b925e308518ddf821ba91952c41ae77c77507/Event/GetResponseForExceptionEvent.php#L55
12+
new MethodCallRename(
13+
'Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent',
14+
'getException',
15+
'getThrowable'
16+
),
17+
18+
// https://github.com/symfony/http-kernel/blob/801b925e308518ddf821ba91952c41ae77c77507/Event/GetResponseForExceptionEvent.php#L67
19+
new MethodCallRename(
20+
'Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent',
21+
'setException',
22+
'setThrowable'
23+
),
24+
]);
25+
};
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\Symfony44\Rector\MethodCall\AuthorizationCheckerIsGrantedExtractorRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->rules([
10+
AuthorizationCheckerIsGrantedExtractorRector::class,
11+
]);
12+
};
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\Renaming\Rector\Name\RenameClassRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
10+
'Symfony\Component\Templating\EngineInterface' => 'Twig\Environment',
11+
]);
12+
};

0 commit comments

Comments
 (0)