Skip to content

[DX] Add RequiredPolyfillInterface to some rule to enable then, once the project is using polyfill package #8368

@TomasVotruba

Description

@TomasVotruba

E.g. if the project composer.json contains:

{
    "require": {
         "symfony/polyfill-php80": "^1.26",
    }
}

We upgrade to PHP 8.0 features, that benefit from this package. It must be manually checked what Rector rules should be extended, as this polyfill only adds helper for few functions, not all PHP 8.0 features.

To enable such a rule, it must require RequiredPolyfillInterface contract:

class SomeRector implements RequiredPolyfillInterface
{
     public function getPolyfill(): string
    {
         return 'symfony/polyfill-php80';
     }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions