8000 [Symfony61] Add rules for upgrade (#266) · rectorphp/rector-symfony@5edba8c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5edba8c

Browse files
authored
[Symfony61] Add rules for upgrade (#266)
Co-authored-by: johan <johan@adivare.nl>
1 parent fd2b5dc commit 5edba8c

File tree

12 files changed

+157
-1
lines changed

12 files changed

+157
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Symfony\Set\SymfonyLevelSetList;
7+
use Rector\Symfony\Set\SymfonySetList;
8+
9+
return static function (RectorConfig $rectorConfig): void {
10+
$rectorConfig->sets([SymfonySetList::SYMFONY_61, SymfonyLevelSetList::UP_TO_SYMFONY_60]);
11+
};

config/sets/symfony/level/up-to-symfony-62.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
use Rector\Symfony\Set\SymfonySetList;
88

99
return static function (RectorConfig $rectorConfig): void {
10-
$rectorConfig->sets([SymfonySetList::SYMFONY_62, SymfonyLevelSetList::UP_TO_SYMFONY_60]);
10+
$rectorConfig->sets([SymfonySetList::SYMFONY_62, SymfonyLevelSetList::UP_TO_SYMFONY_61]);
1111
};

config/sets/symfony/symfony61.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Renaming\Rector\Name\RenameClassRector;
7+
use Rector\Symfony\Rector\Class_\CommandPropertyToAttributeRector;
8000 8+
9+
# https://github.com/symfony/symfony/blob/6.1/UPGRADE-6.1.md
10+
11+
return static function (RectorConfig $rectorConfig): void {
12+
$rectorConfig->rule(CommandPropertyToAttributeRector::class);
13+
14+
$rectorConfig->ruleWithConfiguration(
15+
RenameClassRector::class,
16+
[
17+
// @see https://github.com/symfony/symfony/pull/43982
18+
'Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface' => 'Symfony\Component\Serializer\Normalizer\DenormalizerInterface',
19+
'Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface' => 'Symfony\Component\Serializer\Normalizer\NormalizerInterface',
20+
],
21+
);
22+
};

src/Set/SymfonyLevelSetList.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ final class SymfonyLevelSetList implements SetListInterface
108108
*/
109109
final public const UP_TO_SYMFONY_60 = __DIR__ . '/../../config/sets/symfony/level/up-to-symfony-60.php';
110110

111+
/**
112+
* @var string
113+
*/
114+
final public const UP_TO_SYMFONY_61 = __DIR__ . '/../../config/sets/symfony/level/up-to-symfony-61.php';
115+
111116
/**
112117
* @var string
113118
*/

src/Set/SymfonySetList.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ final class SymfonySetList implements SetListInterface
123123
*/
124124
final public const SYMFONY_60 = __DIR__ . '/../../config/sets/symfony/symfony60.php';
125125

126+
/**
127+
* @var string
128+
*/
129+
final public const SYMFONY_61 = __DIR__ . '/../../config/sets/symfony/symfony61.php';
130+
126131
/**
127132
* @var string
128133
*/
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Symfony\Component\Serializer\Normalizer;
4+
5+
if (interface_exists('Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface')) {
6+
return;
7+
}
8+
9+
interface ContextAwareDenormalizerInterface
10+
{
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Symfony\Component\Serializer\Normalizer;
4+
5+
if (interface_exists('Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface')) {
6+
return;
7+
}
8+
9+
interface ContextAwareNormalizerInterface
10+
{
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Symfony\Component\Serializer\Normalizer;
4+
5+
if (interface_exists('Symfony\Component\Serializer\Normalizer\DenormalizerInterface')) {
6+
return;
7+
}
8+
9+
interface DenormalizerInterface
10+
{
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Symfony\Component\Serializer\Normalizer;
4+
5+
if (interface_exists('Symfony\Component\Serializer\Normalizer\NormalizerInterface')) {
6+
return;
7+
}
8+
9+
interface NormalizerInterface
10+
{
11+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Rector\Symfony\Tests\Set\Symfony61\Fixture;
4+
5+
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
6+
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
7+
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
8+
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
9+
10+
class ReplaceDepricatedInterfacesSerializer implements DenormalizerInterface, NormalizerInterface, ContextAwareNormalizerInterface, ContextAwareDenormalizerInterface
11+
{
12+
}
13+
14+
?>
15+
-----
16+
<?php
17+
18+
namespace Rector\Symfony\Tests\Set\Symfony61\Fixture;
19+
20+
use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface;
21+
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
22+
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
23+
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
24+
25+
class ReplaceDepricatedInterfacesSerializer implements DenormalizerInterface, NormalizerInterface
26+
{
27+
}
28+
29+
?>

0 commit comments

Comments
 (0)
0