From 2c0932e50c62f7991b684c9b0560c624ba8312d5 Mon Sep 17 00:00:00 2001 From: Shadi Sharaf Date: Wed, 2 Sep 2026 01:26:32 +0300 Subject: [PATCH] Add Rector 2.6 dev tooling and empty rector.php for PHP 8.2. Config-only: require-dev pin, on-demand composer scripts, cache under artifacts/, PHPCS exclude for cache dir. No plugin source changes. --- composer.json | 7 +++ composer.lock | 123 ++++++++++++++++++++++++++++++++++++++++++++++++- phpcs.xml.dist | 1 + rector.php | 43 +++++++++++++++++ 4 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 rector.php diff --git a/composer.json b/composer.json index 8b26dc9af..fae08a57e 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ "phpcompatibility/php-compatibility": "dev-develop as 9.99.99", "phpcompatibility/phpcompatibility-wp": "^2.1", "phpunit/phpunit": "^11.3.3", + "rector/rector": "^2.6", "roots/wordpress": "^6.9", "wordpress/mcp-adapter": "^0.5", "wp-cli/wp-cli-bundle": "^2.6", @@ -88,6 +89,12 @@ "lint-tests": [ "phpcs ./tests --standard=./tests/phpcs.xml.dist" ], + "lint-rector": [ + "rector process --dry-run" + ], + "rector": [ + "rector process" + ], "format": [ "phpcbf .", "phpcbf ./tests --standard=./tests/phpcs.xml.dist" diff --git a/composer.lock b/composer.lock index 413b58349..776c13b4f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ccf86efc366801a775693b6a1320fb02", + "content-hash": "9144c5a540bec867c45f2dd0ae234e49", "packages": [ { "name": "composer/installers", @@ -2865,6 +2865,70 @@ ], "time": "2024-05-20T13:34:27+00:00" }, + { + "name": "phpstan/phpstan", + "version": "2.2.12", + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/174b0d88710f00a42598886504dd7a146f91ace5", + "reference": "174b0d88710f00a42598886504dd7a146f91ace5", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ondřej Mirtes" + }, + { + "name": "Markus Staab" + }, + { + "name": "Vincent Langlet" + } + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2026-08-31T19:09:43+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "11.0.12", @@ -3681,6 +3745,63 @@ ], "time": "2025-08-19T18:57:03+00:00" }, + { + "name": "rector/rector", + "version": "2.6.5", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "f8686605798c755456327a3597201c3b5be76294" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/f8686605798c755456327a3597201c3b5be76294", + "reference": "f8686605798c755456327a3597201c3b5be76294", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0", + "phpstan/phpstan": "^2.2.10" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "homepage": "https://getrector.com/", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/2.6.5" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2026-08-30T22:02:04+00:00" + }, { "name": "roots/wordpress", "version": "6.9.1", diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 11c5e8c83..922f5a220 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -32,6 +32,7 @@ *.ruleset */.ai/* + */artifacts/* */tests/* */vendor/* */build/* diff --git a/rector.php b/rector.php new file mode 100644 index 000000000..d8da00d2b --- /dev/null +++ b/rector.php @@ -0,0 +1,43 @@ +withPaths( + array( + __DIR__ . '/stream.php', + __DIR__ . '/abilities', + __DIR__ . '/alerts', + __DIR__ . '/classes', + __DIR__ . '/connectors', + __DIR__ . '/exporters', + __DIR__ . '/includes', + ) + ) + ->withSkip( + array( + __DIR__ . '/.ai', + __DIR__ . '/artifacts', + __DIR__ . '/build', + __DIR__ . '/local', + __DIR__ . '/node_modules', + __DIR__ . '/tests', + __DIR__ . '/vendor', + // Per-rule skips are appended by the PR that registers the rule (§3, §4). + ) + ) + ->withPhpVersion( PhpVersion::PHP_82 ) + ->withCache( __DIR__ . '/artifacts/rector' ) + ->withRules( array() );