fsylum / rector-wordpress
Rector upgrades rules for WordPress
Installs: 4 847
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 0
Open Issues: 0
Type:rector-extension
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
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, ]); };