|
2 | 2 |
|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
5 | | -use PHPStan\Type\IterableType; |
6 | | -use PHPStan\Type\MixedType; |
7 | | -use Rector\Arguments\NodeAnalyzer\ArgumentAddingScope; |
8 | | -use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector; |
9 | | -use Rector\Arguments\Rector\ClassMethod\ReplaceArgumentDefaultValueRector; |
10 | | -use Rector\Arguments\ValueObject\ArgumentAdder; |
11 | | -use Rector\Arguments\ValueObject\ReplaceArgumentDefaultValue; |
12 | 5 | use Rector\Config\RectorConfig; |
13 | | -use Rector\Removing\Rector\ClassMethod\ArgumentRemoverRector; |
14 | | -use Rector\Removing\ValueObject\ArgumentRemover; |
15 | | -use Rector\Renaming\Rector\MethodCall\RenameMethodRector; |
16 | | -use Rector\Renaming\Rector\Name\RenameClassRector; |
17 | | -use Rector\Renaming\ValueObject\MethodCallRename; |
18 | | -use Rector\Symfony\Symfony42\Rector\New_\RootNodeTreeBuilderRector; |
19 | | -use Rector\Symfony\Symfony42\Rector\New_\StringToArrayArgumentProcessRector; |
20 | | -use Rector\Transform\Rector\ClassMethod\WrapReturnRector; |
21 | | -use Rector\Transform\Rector\New_\NewToStaticCallRector; |
22 | | -use Rector\Transform\ValueObject\NewToStaticCall; |
23 | | -use Rector\Transform\ValueObject\WrapReturn; |
24 | | -use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector; |
25 | | -use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration; |
26 | | -use Rector\ValueObject\MethodName; |
27 | | -use Rector\ValueObject\Visibility; |
28 | | -use Rector\Visibility\Rector\ClassMethod\ChangeMethodVisibilityRector; |
29 | | -use Rector\Visibility\ValueObject\ChangeMethodVisibility; |
30 | 6 |
|
31 | 7 | # https://github.com/symfony/symfony/pull/28447 |
32 | 8 |
|
33 | 9 | return static function (RectorConfig $rectorConfig): void { |
34 | | - $rectorConfig->ruleWithConfiguration(NewToStaticCallRector::class, [ |
35 | | - new NewToStaticCall( |
36 | | - 'Symfony\Component\HttpFoundation\Cookie', |
37 | | - 'Symfony\Component\HttpFoundation\Cookie', |
38 | | - 'create' |
39 | | - ), |
40 | | - ]); |
41 | | - |
42 | | - $rectorConfig->ruleWithConfiguration(RenameClassRector::class, [ |
43 | | - # https://github.com/symfony/symfony/commit/a7e319d9e1316e2e18843f8ce15b67a8693e5bf9 |
44 | | - 'Symfony\Bundle\FrameworkBundle\Controller\Controller' => 'Symfony\Bundle\FrameworkBundle\Controller\AbstractController', |
45 | | - # https://github.com/symfony/symfony/commit/744bf0e7ac3ecf240d0bf055cc58f881bb0b3ec0 |
46 | | - 'Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand' => 'Symfony\Component\Console\Command\Command', |
47 | | - 'Symfony\Component\Translation\TranslatorInterface' => 'Symfony\Contracts\Translation\TranslatorInterface', |
48 | | - ]); |
49 | | - |
50 | | - $rectorConfig->rules([ |
51 | | - # https://symfony.com/blog/new-in-symfony-4-2-important-deprecations |
52 | | - StringToArrayArgumentProcessRector::class, |
53 | | - RootNodeTreeBuilderRector::class, |
54 | | - ]); |
55 | | - |
56 | | - $rectorConfig->ruleWithConfiguration(ArgumentAdderRector::class, [ |
57 | | - new ArgumentAdder( |
58 | | - 'Symfony\Component\DomCrawler\Crawler', |
59 | | - 'children', |
60 | | - 0, |
61 | | - null, |
62 | | - null, |
63 | | - null, |
64 | | - ArgumentAddingScope::SCOPE_METHOD_CALL |
65 | | - ), |
66 | | - new ArgumentAdder( |
67 | | - 'Symfony\Component\Finder\Finder', |
68 | | - 'sortByName', |
69 | | - 0, |
70 | | - null, |
71 | | - false, |
72 | | - null, |
73 | | - ArgumentAddingScope::SCOPE_METHOD_CALL |
74 | | - ), |
75 | | - new ArgumentAdder( |
76 | | - 'Symfony\Bridge\Monolog\Processor\DebugProcessor', |
77 | | - 'getLogs', |
78 | | - 0, |
79 | | - null, |
80 | | - null, |
81 | | - null, |
82 | | - ArgumentAddingScope::SCOPE_METHOD_CALL |
83 | | - ), |
84 | | - new ArgumentAdder( |
85 | | - 'Symfony\Bridge\Monolog\Processor\DebugProcessor', |
86 | | - 'countErrors', |
87 | | - 0, |
88 | | - 'default_value', |
89 | | - null, |
90 | | - null, |
91 | | - ArgumentAddingScope::SCOPE_METHOD_CALL |
92 | | - ), |
93 | | - new ArgumentAdder( |
94 | | - 'Symfony\Bridge\Monolog\Logger', |
95 | | - 'getLogs', |
96 | | - 0, |
97 | | - 'default_value', |
98 | | - null, |
99 | | - null, |
100 | | - ArgumentAddingScope::SCOPE_METHOD_CALL |
101 | | - ), |
102 | | - new ArgumentAdder( |
103 | | - 'Symfony\Bridge\Monolog\Logger', |
104 | | - 'countErrors', |
105 | | - 0, |
106 | | - 'default_value', |
107 | | - null, |
108 | | - null, |
109 | | - ArgumentAddingScope::SCOPE_METHOD_CALL |
110 | | - ), |
111 | | - new ArgumentAdder( |
112 | | - 'Symfony\Component\Serializer\Normalizer', |
113 | | - 'handleCircularReference', |
114 | | - 1, |
115 | | - null, |
116 | | - null, |
117 | | - null, |
118 | | - ArgumentAddingScope::SCOPE_METHOD_CALL |
119 | | - ), |
120 | | - new ArgumentAdder( |
121 | | - 'Symfony\Component\Serializer\Normalizer', |
122 | | - 'handleCircularReference', |
123 | | - 2, |
124 | | - null, |
125 | | - null, |
126 | | - null, |
127 | | - ArgumentAddingScope::SCOPE_METHOD_CALL |
128 | | - ), |
129 | | - ]); |
130 | | - |
131 | | - $rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [ |
132 | | - new MethodCallRename('Symfony\Component\Cache\CacheItem', 'getPreviousTags', 'getMetadata'), |
133 | | - new MethodCallRename('Symfony\Component\Form\AbstractTypeExtension', 'getExtendedType', 'getExtendedTypes'), |
134 | | - ]); |
135 | | - |
136 | | - $iterableType = new IterableType(new MixedType(), new MixedType()); |
137 | | - |
138 | | - $rectorConfig->ruleWithConfiguration(AddReturnTypeDeclarationRector::class, [ |
139 | | - new AddReturnTypeDeclaration( |
140 | | - 'Symfony\Component\Form\AbstractTypeExtension', |
141 | | - 'getExtendedTypes', |
142 | | - $iterableType |
143 | | - ), |
144 | | - ]); |
145 | | - |
146 | | - $rectorConfig->ruleWithConfiguration(ChangeMethodVisibilityRector::class, [new ChangeMethodVisibility( |
147 | | - 'Symfony\Component\Form\AbstractTypeExtension', |
148 | | - 'getExtendedTypes', |
149 | | - Visibility::STATIC |
150 | | - ), |
151 | | - ]); |
152 | | - |
153 | | - $rectorConfig->ruleWithConfiguration( |
154 | | - WrapReturnRector::class, |
155 | | - [new WrapReturn('Symfony\Component\Form\AbstractTypeExtension', 'getExtendedTypes', true)] |
156 | | - ); |
157 | | - |
158 | | - // https://github.com/symfony/symfony/commit/9493cfd5f2366dab19bbdde0d0291d0575454567 |
159 | | - $rectorConfig->ruleWithConfiguration(ReplaceArgumentDefaultValueRector::class, [ |
160 | | - new ReplaceArgumentDefaultValue( |
161 | | - 'Symfony\Component\HttpFoundation\Cookie', |
162 | | - MethodName::CONSTRUCT, |
163 | | - 5, |
164 | | - false, |
165 | | - null |
166 | | - ), |
167 | | - new ReplaceArgumentDefaultValue( |
168 | | - 'Symfony\Component\HttpFoundation\Cookie', |
169 | | - MethodName::CONSTRUCT, |
170 | | - 8, |
171 | | - null, |
172 | | - 'lax' |
173 | | - ), |
174 | | - ]); |
175 | | - |
176 | | - # https://github.com/symfony/symfony/commit/f5c355e1ba399a1b3512367647d902148bdaf09f |
177 | | - $rectorConfig->ruleWithConfiguration(ArgumentRemoverRector::class, [ |
178 | | - new ArgumentRemover( |
179 | | - 'Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector', |
180 | | - MethodName::CONSTRUCT, |
181 | | - 0, |
182 | | - null |
183 | | - ), |
184 | | - new ArgumentRemover( |
185 | | - 'Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector', |
186 | | - MethodName::CONSTRUCT, |
187 | | - 1, |
188 | | - null |
189 | | - ), |
190 | | - ]); |
| 10 | + $rectorConfig->import(__DIR__ . '/symfony42/symfony42-http-foundation.php'); |
| 11 | + $rectorConfig->import(__DIR__ . '/symfony42/symfony42-http-kernel.php'); |
| 12 | + $rectorConfig->import(__DIR__ . '/symfony42/symfony42-framework-bundle.php'); |
| 13 | + $rectorConfig->import(__DIR__ . '/symfony42/symfony42-translation.php'); |
| 14 | + $rectorConfig->import(__DIR__ . '/symfony42/symfony42-process.php'); |
| 15 | + $rectorConfig->import(__DIR__ . '/symfony42/symfony42-config.php'); |
| 16 | + $rectorConfig->import(__DIR__ . '/symfony42/symfony42-dom-crawler.php'); |
| 17 | + $rectorConfig->import(__DIR__ . '/symfony42/symfony42-finder.php'); |
| 18 | + $rectorConfig->import(__DIR__ . '/symfony42/symfony42-monolog-bridge.php'); |
| 19 | + $rectorConfig->import(__DIR__ . '/symfony42/symfony42-serializer.php'); |
| 20 | + $rectorConfig->import(__DIR__ . '/symfony42/symfony42-forms.php'); |
| 21 | + $rectorConfig->import(__DIR__ . '/symfony42/symfony42-cache.php'); |
191 | 22 | }; |
0 commit comments