fsylum/rector-wordpress

Rector upgrades rules for WordPress

Installs: 42

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 1

Forks: 0

Open Issues: 2

Type:rector-extension

0.3.0 2024-04-29 15:38 UTC

This package is auto-updated.

Last update: 2024-04-29 15:39:06 UTC


README

This package is a Rector extension developed to provide upgrades rules for WordPress.

Install

Install the rector-wordpress package as dependency:

composer require fsylum/rector-wordpress --dev

Use Sets

To add a set to your config, use Fsylum\RectorWordPress\Set\WordPressSetList class and pick one of the constants. For example, to update the codebase to WordPress 6.4, use WordPressSetList::WP_6_4.

use Fsylum\RectorWordPress\Set\WordPressSetList;
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->sets([
        WordPressSetList::WP_6_4,
    ]);
};

You can also use a level set list to include all the applicable rules from the lowest version, 0.71 up to the one you specified. For example, WordPressLevelSetList::UP_TO_WP_6_4 will include all the rules from WordPress 0.71 up to 6.4. In most cases, this is the preferable way to transform your code as you only need to specify it once.

use Fsylum\RectorWordPress\Set\WordPressLevelSetList;
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->sets([
        WordPressLevelSetList::UP_TO_WP_6_4,
    ]);
};