Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Rector upgrade script as Composer plugin #76

Open
3 tasks
rvanlaak opened this issue Nov 23, 2021 · 1 comment
Open
3 tasks

Run Rector upgrade script as Composer plugin #76

rvanlaak opened this issue Nov 23, 2021 · 1 comment

Comments

@rvanlaak
Copy link
Collaborator

rvanlaak commented Nov 23, 2021

Given PHP 8.0 will be the minium PHP version for v2, running a Rector upgrade script will always upgrade the annotations to attributes.

This idea came up during the PHPWVL talk where Tomas Votruba held a talk about including effortless upgradeability as a Composer Plugin, and is a follow-up of the discussion in #72

TODO

  • find a way how to hook into the Rector process to transform the parameter labels
  • rewrite the old route array values to routeName, routeParameters, routeAbsolute
  • find a way to run a Rector rule when installing v2 (and how to only run it once)

Sample Rector rule

return static function (ContainerConfigurator $containerConfigurator): void {
    $services = $containerConfigurator->services();
    $services->set(AnnotationToAttributeRector::class)->call('configure', [
        [
            AnnotationToAttributeRector::ANNOTATION_TO_ATTRIBUTE => ValueObjectInliner::inline([
                new AnnotationToAttribute(\APY\BreadcrumbTrailBundle\Annotation\Breadcrumb::class),
            ]),
        ],
    ]);
};
@rvanlaak
Copy link
Collaborator Author

Created an issue with Rector to ask about modifying parameter labels rectorphp/rector#6825

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant