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
4 changes: 4 additions & 0 deletions config/sets/symfony/composer-based.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
use Rector\Symfony\CodeQuality\Rector\AttributeGroup\SingleConditionSecurityAttributeToIsGrantedRector;
use Rector\Symfony\CodeQuality\Rector\Class_\SplitAndSecurityAttributeToIsGrantedRector;
use Rector\Symfony\Symfony25\Rector\MethodCall\AddViolationToBuildViolationRector;
use Rector\Symfony\Symfony26\Rector\MethodCall\RedirectToRouteRector;
use Rector\Symfony\Symfony42\Rector\New_\RootNodeTreeBuilderRector;
use Rector\Symfony\Symfony42\Rector\New_\StringToArrayArgumentProcessRector;
use Rector\Symfony\Symfony43\Rector\ClassMethod\EventDispatcherParentConstructRector;
Expand Down Expand Up @@ -95,6 +96,9 @@
// symfony/validator 2.5
AddViolationToBuildViolationRector::class,

// symfony/framework-bundle 2.6
RedirectToRouteRector::class,

// symfony/config 4.2
RootNodeTreeBuilderRector::class,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}

protected function provideComposerJsonFilePath(): string
{
return __DIR__ . '/config/composer.json';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"symfony/framework-bundle": "^2.6"
}
}
11 changes: 10 additions & 1 deletion rules/Symfony26/Rector/MethodCall/RedirectToRouteRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,28 @@
use PhpParser\Node\Expr\MethodCall;
use Rector\Rector\AbstractRector;
use Rector\Symfony\TypeAnalyzer\ControllerAnalyzer;
use Rector\VersionBonding\Contract\ComposerPackageConstraintInterface;
use Rector\VersionBonding\ValueObject\ComposerPackageConstraint;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;

/**
* @changelog https://github.com/symfony/symfony/blob/2.6/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
*
* @see \Rector\Symfony\Tests\Symfony26\Rector\MethodCall\RedirectToRouteRector\RedirectToRouteRectorTest
*/
final class RedirectToRouteRector extends AbstractRector
final class RedirectToRouteRector extends AbstractRector implements ComposerPackageConstraintInterface
{
public function __construct(
private readonly ControllerAnalyzer $controllerAnalyzer
) {
}

public function provideComposerPackageConstraint(): ComposerPackageConstraint
{
return new ComposerPackageConstraint('symfony/framework-bundle', '>=2.6');
}

public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
Expand Down
Loading