Skip to content

Commit

Permalink
chore(rector): add new rules and update configuration
Browse files Browse the repository at this point in the history
- Added new imports for `Response`, `ReturnTypeWillChangeRector`, and `RectorConfigBuilderRector`.
- Included current file in the paths for the rector configuration.
- Updated the rules with `ReturnTypeWillChangeRector` for specific class methods.
- Ensured the configuration is aligned with recent changes.
  • Loading branch information
guanguans committed Oct 1, 2024
1 parent e010146 commit c670c38
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8",
"brainmaestro/composer-git-hooks": "^2.8 || ^3.0",
"ergebnis/composer-normalize": "^2.43",
"ergebnis/license": "^2.4",
"ergebnis/composer-normalize": "^2.44",
"ergebnis/license": "^2.5",
"ergebnis/php-cs-fixer-config": "dev-main",
"ergebnis/rector-rules": "^1.0",
"ergebnis/rector-rules": "^1.1",
"guanguans/ai-commit": "dev-main",
"guanguans/monorepo-builder-worker": "^1.4",
"icanhazstring/composer-unused": "^0.8",
Expand All @@ -96,7 +96,7 @@
"infection/infection": "^0.26",
"maglnet/composer-require-checker": "^3.8 || ^4.0",
"mockery/mockery": "^1.6",
"pestphp/pest": "^1.23 || ^2.0",
"pestphp/pest": "^1.23 || ^2.0 || ^3.0",
"pestphp/pest-plugin-faker": "^1.0 || ^2.0 || ^3.0",
"php-mock/php-mock-phpunit": "^2.10",
"phpbench/phpbench": "^1.2",
Expand Down
12 changes: 12 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Guanguans\Notify\Foundation\Rectors\HasHttpClientDocCommentRector;
use Guanguans\Notify\Foundation\Rectors\HasOptionsDocCommentRector;
use Guanguans\Notify\Foundation\Rectors\ToInternalExceptionRector;
use Guanguans\Notify\Foundation\Response;
use GuzzleHttp\RequestOptions;
use Rector\CodeQuality\Rector\ClassMethod\ExplicitReturnNullRector;
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
Expand All @@ -41,7 +42,10 @@
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Transform\Rector\ClassMethod\ReturnTypeWillChangeRector;
use Rector\Transform\Rector\FileWithoutNamespace\RectorConfigBuilderRector;
use Rector\Transform\Rector\String_\StringToClassConstantRector;
use Rector\Transform\ValueObject\ClassMethodReference;
use Rector\Transform\ValueObject\StringToClassConstant;
use Rector\ValueObject\PhpVersion;
use Rector\ValueObject\Visibility;
Expand Down Expand Up @@ -80,6 +84,7 @@
]);

$rectorConfig->paths([
__FILE__,
__DIR__.'/src',
__DIR__.'/tests',
__DIR__.'/.*.php',
Expand Down Expand Up @@ -151,6 +156,7 @@
StaticArrowFunctionRector::class,
StaticClosureRector::class,
HasOptionsDocCommentRector::class,
RectorConfigBuilderRector::class,
]);

$rectorConfig->sets([
Expand Down Expand Up @@ -195,6 +201,12 @@
),
);

$rectorConfig->ruleWithConfiguration(ReturnTypeWillChangeRector::class, [
new ClassMethodReference(ArrayAccess::class, 'offsetGet'),
new ClassMethodReference(HasOptions::class, 'offsetGet'),
new ClassMethodReference(Response::class, 'offsetGet'),
]);

$rectorConfig->ruleWithConfiguration(ChangeMethodVisibilityRector::class, [
new ChangeMethodVisibility(HasOptions::class, 'preConfigureOptionsResolver', Visibility::PROTECTED),
]);
Expand Down

0 comments on commit c670c38

Please sign in to comment.