Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/sets/symfony/symfony7/symfony74.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/symfony74/symfony74-console.php');
$rectorConfig->import(__DIR__ . '/symfony74/symfony74-framework-bundle.php');
$rectorConfig->import(__DIR__ . '/symfony74/symfony74-routing.php');
};
14 changes: 14 additions & 0 deletions config/sets/symfony/symfony7/symfony74/symfony74-routing.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\ValueObject\MethodCallRename;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [
// @see https://github.com/symfony/symfony/pull/61358
new MethodCallRename('Symfony\Component\Routing\Attribute\Route', 'setEnv', 'setEnvs'),
]);
};
6 changes: 6 additions & 0 deletions src/Set/SetProvider/Symfony7SetProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ public function provide(): array
'7.4',
__DIR__ . '/../../../config/sets/symfony/symfony7/symfony74/symfony74-framework-bundle.php'
),
new ComposerTriggeredSet(
SetGroup::SYMFONY,
'symfony/routing',
'7.4',
__DIR__ . '/../../../config/sets/symfony/symfony7/symfony74/symfony74-routing.php'
),
];
}
}
33 changes: 33 additions & 0 deletions tests/Set/Symfony74/Fixture/router_set_env_to_set_envs.php.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Rector\Symfony\Tests\Set\Symfony74\Fixture;

use Symfony\Component\Routing\Attribute\Route;

class RouterSetEnvToSetEnvs
{
public function someAction()
{
$route = new Route('/path');
$route->setEnv('prod');
}
}

?>
-----
<?php

namespace Rector\Symfony\Tests\Set\Symfony74\Fixture;

use Symfony\Component\Routing\Attribute\Route;

class RouterSetEnvToSetEnvs
{
public function someAction()
{
$route = new Route('/path');
$route->setEnvs('prod');
}
}

?>
28 changes: 28 additions & 0 deletions tests/Set/Symfony74/Symfony74Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace Rector\Symfony\Tests\Set\Symfony74;

use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;

final class Symfony74Test extends AbstractRectorTestCase
{
#[DataProvider('provideData')]
public function test(string $filePath): void
{
$this->doTestFile($filePath);
}

public static function provideData(): Iterator
{
return self::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}

public function provideConfigFilePath(): string
{
return __DIR__ . '/config/symfony74.php';
}
}
10 changes: 10 additions & 0 deletions tests/Set/Symfony74/config/symfony74.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Symfony\Set\SymfonySetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([SymfonySetList::SYMFONY_74]);
};