Skip to content

rectorphp/rector-downgrade-php

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

9bab626 · Dec 20, 2024
Aug 12, 2024
Dec 19, 2024
Aug 12, 2024
Dec 20, 2024
Dec 20, 2024
Nov 27, 2024
Jun 28, 2022
Dec 12, 2024
Jun 27, 2022
Sep 1, 2023
Aug 4, 2023
Jun 28, 2022
Aug 12, 2024
Dec 3, 2024
Sep 13, 2023
Nov 20, 2024
May 29, 2023
May 30, 2024

Repository files navigation

Rector Rules for PHP Downgrade

See available Downgrade rules

Install

This package is already part of rector/rector package, so it works out of the box.

All you need to do is install the main package, and you're good to go:

composer require rector/rector --dev

Use Sets

To add a set to your config, use Rector\Set\ValueObject\DowngradeLevelSetList class and pick target set:

use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->sets([
        DowngradeLevelSetList::DOWN_TO_PHP_72
    ]);
};

Then run Rector to downgrade your code to PHP 7.2!

vendor/bin/rector

How the Downgrade Workflow looks?

It's simple in the nature. Read these how-to posts to get the idea:


Learn Rector Faster

Rector is a tool that we develop and share for free, so anyone can save hundreds of hours on refactoring. But not everyone has time to understand Rector and AST complexity. You have 2 ways to speed this process up:

Both ways support us to and improve Rector in sustainable way by learning from practical projects.