Skip to content

Commit dd2d556

Browse files
authored
[symfony 5.0 and 5.1] Split config to per-package configs (#735)
1 parent a4ad985 commit dd2d556

31 files changed

Lines changed: 429 additions & 210 deletions
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+
7+
# https://github.com/symfony/symfony/blob/5.0/UPGRADE-5.0.md
8+
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->import(__DIR__ . '/symfony50/symfony50-types.php');
11+
$rectorConfig->import(__DIR__ . '/symfony50/symfony50-console.php');
12+
$rectorConfig->import(__DIR__ . '/symfony50/symfony50-debug.php');
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\MethodCall\RenameMethodRector;
7+
use Rector\Renaming\ValueObject\MethodCallRename;
8+
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
11+
new MethodCallRename('Symfony\Component\Console\Application', 'renderException', 'renderThrowable'),
12+
new MethodCallRename('Symfony\Component\Console\Application', 'doRenderException', 'doRenderThrowable'),
13+
]);
14+
};
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\Debug\Debug' => 'Symfony\Component\ErrorHandler\Debug',
11+
]);
12+
};

config/sets/symfony/symfony50-types.php renamed to config/sets/symfony/symfony5/symfony50/symfony50-types.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,5 +355,30 @@
355355
1,
356356
new StringType()
357357
),
358+
359+
new AddParamTypeDeclaration(
360+
'Symfony\Component\Security\Core\User\UserProviderInterface',
361+
'loadUserByUsername',
362+
0,
363+
new StringType(),
364+
),
365+
new AddParamTypeDeclaration(
366+
'Symfony\Component\Security\Core\User\UserProviderInterface',
367+
'supportsClass',
368+
0,
369+
new StringType(),
370+
),
371+
new AddParamTypeDeclaration(
372+
'Symfony\Bridge\Doctrine\Security\User\EntityUserProvider',
373+
'loadUserByUsername',
374+
0,
375+
new StringType(),
376+
),
377+
new AddParamTypeDeclaration(
378+
'Symfony\Bridge\Doctrine\Security\User\EntityUserProvider',
379+
'supportsClass',
380+
0,
381+
new StringType(),
382+
),
358383
]);
359384
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
# https://github.com/symfony/symfony/blob/5.x/UPGRADE-5.1.md
6+
use Rector\Config\RectorConfig;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->import(__DIR__ . '/symfony51/symfony51-config.php');
10+
$rectorConfig->import(__DIR__ . '/symfony51/symfony51-console.php');
11+
$rectorConfig->import(__DIR__ . '/symfony51/symfony51-dependency-injection.php');
12+
$rectorConfig->import(__DIR__ . '/symfony51/symfony51-event-dispatcher.php');
13+
$rectorConfig->import(__DIR__ . '/symfony51/symfony51-forms.php');
14+
$rectorConfig->import(__DIR__ . '/symfony51/symfony51-framework-bundle.php');
15+
$rectorConfig->import(__DIR__ . '/symfony51/symfony51-http-foundation.php');
16+
$rectorConfig->import(__DIR__ . '/symfony51/symfony51-inflector.php');
17+
$rectorConfig->import(__DIR__ . '/symfony51/symfony51-notifier.php');
18+
$rectorConfig->import(__DIR__ . '/symfony51/symfony51-security-http.php');
19+
20+
};
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\MethodCall\RenameMethodRector;
7+
use Rector\Renaming\ValueObject\MethodCallRename;
8+
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
11+
new MethodCallRename(
12+
'Symfony\Component\Config\Definition\BaseNode',
13+
'getDeprecationMessage',
14+
'getDeprecation'
15+
),
16+
]);
17+
};
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\Symfony51\Rector\ClassMethod\CommandConstantReturnCodeRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->rules([
10+
// @see https://symfony.com/blog/new-in-symfony-5-1-misc-improvements-part-1#added-constants-for-command-exit-codes
11+
CommandConstantReturnCodeRector::class,
12+
]);
13+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
7+
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
8+
use Rector\Renaming\ValueObject\MethodCallRename;
9+
10+
return static function (RectorConfig $rectorConfig): void {
11+
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, [
12+
'Symfony\Component\DependencyInjection\Loader\Configuraton\inline' => 'Symfony\Component\DependencyInjection\Loader\Configuraton\inline_service',
13+
'Symfony\Component\DependencyInjection\Loader\Configuraton\ref' => 'Symfony\Component\DependencyInjection\Loader\Configuraton\service',
14+
]);
15+
16+
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
17+
new MethodCallRename(
18+
'Symfony\Component\DependencyInjection\Definition',
19+
'getDeprecationMessage',
20+
'getDeprecation'
21+
),
22+
new MethodCallRename(
23+
'Symfony\Component\DependencyInjection\Alias',
24+
'getDeprecationMessage',
25+
'getDeprecation'
26+
),
27+
]);
28+
};
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\EventDispatcher\LegacyEventDispatcherProxy' => 'Symfony\Component\EventDispatcher\EventDispatcherInterface',
11+
]);
12+
};
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
10+
return static function (RectorConfig $rectorConfig): void {
11+
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
12+
'Symfony\Component\Form\Extension\Validator\Util\ServerParams' => 'Symfony\Component\Form\Util\ServerParams',
13+
]);
14+
15+
$rectorConfig->ruleWithConfiguration(RenameClassConstFetchRector::class, [
16+
new RenameClassAndConstFetch(
17+
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
18+
'ROUND_FLOOR',
19+
'NumberFormatter',
20+
'ROUND_FLOOR'
21+
),
22+
new RenameClassAndConstFetch(
23+
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
24+
'ROUND_DOWN',
25+
'NumberFormatter',
26+
'ROUND_DOWN'
27+
),
28+
new RenameClassAndConstFetch(
29+
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
30+
'ROUND_HALF_DOWN',
31+
'NumberFormatter',
32+
'ROUND_HALFDOWN'
33+
),
34+
new RenameClassAndConstFetch(
35+
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
36+
'ROUND_HALF_EVEN',
37+
'NumberFormatter',
38+
'ROUND_HALFEVEN'
39+
),
40+
new RenameClassAndConstFetch(
41+
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
42+
'ROUND_HALFUP',
43+
'NumberFormatter',
44+
'ROUND_HALFUP'
45+
),
46+
new RenameClassAndConstFetch(
47+
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
48+
'ROUND_UP',
49+
'NumberFormatter',
50+
'ROUND_UP'
51+
),
52+
new RenameClassAndConstFetch(
53+
'Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer',
54+
'ROUND_CEILING',
55+
'NumberFormatter',
56+
'ROUND_CEILING'
57+
),
58+
]);
59+
};

0 commit comments

Comments
 (0)