APY / APYBreadcrumbTrailBundle

Generate a dynamic Twig breadcrumbs trail via Annotations, PHP Attributes or PHP methods.
80 stars 30 forks source link

Run Rector upgrade script as Composer plugin #76

Open rvanlaak opened 2 years ago

rvanlaak commented 2 years ago

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 https://github.com/APY/APYBreadcrumbTrailBundle/issues/72

TODO

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 commented 2 years ago

Created an issue with Rector to ask about modifying parameter labels https://github.com/rectorphp/rector/issues/6825