From 9c1c7c37fb1fda08ae9d69dcf03d159abf0e37ee Mon Sep 17 00:00:00 2001 From: guanguans Date: Mon, 13 Jan 2025 21:45:07 +0800 Subject: [PATCH] ci(scope): Update composer.json and add ractor-php82 - Add @rector-php82-dry-run to the composer scripts - Add ractor-php82.php configuration file --- composer.json | 2 ++ psalm-baseline.xml | 2 +- rector-php82.php | 50 ++++++++++++++++++++++++++++++++++++++++++++++ rector.php | 7 ++++++- 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 rector-php82.php diff --git a/composer.json b/composer.json index dcdd19f..ce1acd4 100644 --- a/composer.json +++ b/composer.json @@ -247,6 +247,8 @@ ], "rector": "@php ./vendor/bin/rector --clear-cache --ansi -v", "rector-dry-run": "@rector --dry-run", + "rector-php82": "@rector --config=rector-php82.php", + "rector-php82-dry-run": "@rector-php82 --dry-run", "release": "@php ./vendor/bin/monorepo-builder release --ansi -v", "release-major": "@release major", "release-major-dry-run": "@release-major --dry-run", diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 7735dcb..eb94e72 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + synchronous(true)]]> diff --git a/rector-php82.php b/rector-php82.php new file mode 100644 index 0000000..6b27bbf --- /dev/null +++ b/rector-php82.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + * + * @see https://github.com/guanguans/notify + */ + +use Rector\Config\RectorConfig; +use Rector\Php82\Rector\Param\AddSensitiveParameterAttributeRector; +use Rector\ValueObject\PhpVersion; + +return static function (RectorConfig $rectorConfig): void { + $rectorConfig->importNames(false, false); + $rectorConfig->importShortClasses(false); + $rectorConfig->parallel(240); + // $rectorConfig->disableParallel(); + $rectorConfig->phpstanConfig(__DIR__.'/phpstan.neon'); + $rectorConfig->phpVersion(PhpVersion::PHP_82); + + $rectorConfig->paths([ + __DIR__.'/src/*/Authenticator.php', + __DIR__.'/src/*/*/*Authenticator.php', + ]); + + $rectorConfig->skip([ + __DIR__.'/src/Foundation/Support', + __DIR__.'/src/Foundation/Response.php', + ]); + + $rectorConfig->ruleWithConfiguration(AddSensitiveParameterAttributeRector::class, [ + AddSensitiveParameterAttributeRector::SENSITIVE_PARAMETERS => [ + 'accessToken', + 'apiKey', + 'botApiKey', + 'key', + 'password', + 'pushKey', + 'secret', + 'tempKey', + 'token', + 'webHook', + ], + ]); +}; diff --git a/rector.php b/rector.php index 858056a..ea64a35 100644 --- a/rector.php +++ b/rector.php @@ -211,10 +211,15 @@ $rectorConfig->ruleWithConfiguration(AddSensitiveParameterAttributeRector::class, [ AddSensitiveParameterAttributeRector::SENSITIVE_PARAMETERS => [ 'accessToken', + 'apiKey', + 'botApiKey', 'key', 'password', + 'pushKey', + 'secret', + 'tempKey', 'token', - 'webHook,', + 'webHook', ], ]);