[composer-based] Bond RedirectToRouteRector to symfony/framework-bundle 2.6 - #990
[composer-based] Bond RedirectToRouteRector to symfony/framework-bundle 2.6#990TomasVotruba wants to merge 1 commit into
Conversation
…le 2.6 Controller::redirectToRoute() was added in symfony/framework-bundle 2.6, so the rule now declares that constraint and is registered in the composer-based set. The constraint is resolved from the installed packages, so the rule is skipped whenever symfony/framework-bundle is missing. Add it to require-dev to keep the rule test running, which pulls the remaining symfony dev dependencies up to ^7.4 to resolve.
|
Closing — keeping the dev dependencies as they are means this rule cannot be bonded.
Every rule already in the composer-based set is bonded to a package that happens to be installed, several of them transitively (
|
RedirectToRouteRectorrewrites the redirect helper pair into the shorter route helper:final class SomeController extends AbstractController { public function someAction() { - return $this->redirect($this->generateUrl('something', ['id' => $id])); + return $this->redirectToRoute('something', ['id' => $id]); } }Controller::redirectToRoute()was added in symfony/framework-bundle 2.6, so the rule now declares that package constraint and joins the composer-based set:A project on an older framework-bundle gets the rule skipped instead of a call to a method that does not exist yet.
Heads-up on the dependency change
ComposerPackageConstraintFilterresolves the constraint against the installed packages, so a rule bonded to a package that is not inrequire-devis filtered out during its own test run and every fixture fails. Keeping the test green therefore requiressymfony/framework-bundleas a dev dependency.That does not resolve against the current dev constraints, which sit on three different Symfony lines at once (
dependency-injection ^6.4,http-kernel ^7.4,config ^8.1). Working through the majors:^8.1conflicts withsymfony/console < 8.1, andrector/rector-srcpinssymfony/console ^6.4.24— unresolvable^6.4needshttp-kernel ^6.4andconfig ^6.1|^7.0, both below the current root constraints^7.4resolves, once the packages still pinned at^6.4move upSo this PR also moves
dependency-injection,routing,security-core,security-http,validatorandweb-linkfrom^6.4to^7.4.http-kernelwas already^7.4andconfigstays at^8.1.The full suite passes on the new versions (618 tests, 779 assertions), so nothing in the fixtures appears to depend on the 6.4 APIs. Still, this widens the PR beyond registering one rule — if the
^6.4pins were deliberate, say so and I will drop the bonding instead.