fsylum / rector-wordpress
Rector 升级 WordPress 规则
0.4.0
2024-07-26 02:21 UTC
Requires
- php: >=8.2
- rector/rector: ^1.0
- webmozart/assert: ^1.11
Requires (Dev)
- ergebnis/composer-normalize: ^2.41
- laravel/pint: ^1.13
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.10
- phpstan/phpstan-strict-rules: ^1.5
- phpstan/phpstan-webmozart-assert: ^1.2
- phpunit/phpunit: ^10.5
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, ]); };