Skip to content

Run Rector upgrade script as Composer plugin #76

@rvanlaak

Description

@rvanlaak

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),
            ]),
        ],
    ]);
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions