fsylum/rector-wordpress

Rector 升级 WordPress 规则

安装次数: 4,692

依赖关系: 0

建议者: 0

安全: 0

星标: 5

关注者: 2

分支: 0

开放问题: 0

类型:rector-extension

0.4.0 2024-07-26 02:21 UTC

This package is auto-updated.

Last update: 2024-09-05 01:58:18 UTC


README

本包是Rector扩展,旨在为WordPress提供升级规则。

安装

rector-wordpress包作为依赖项安装

composer require fsylum/rector-wordpress --dev

使用集合

要将集合添加到配置中,请使用Fsylum\RectorWordPress\Set\WordPressSetList类并选择其中一个常量。例如,要将代码库更新到WordPress 6.4,请使用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,
    ]);
};

您还可以使用级别集合列表,包括从最低版本0.71到您指定的版本的所有适用规则。例如,WordPressLevelSetList::UP_TO_WP_6_4将包括从WordPress 0.71到6.4的所有规则。在大多数情况下,这是一种更优的方法,因为您只需指定一次。

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

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