Skip to content

Commit

Permalink
Upgraded to rector 0.18 & did some refactoring for PHP 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rotimi committed Sep 7, 2023
1 parent 1ba9f5e commit e774737
Show file tree
Hide file tree
Showing 18 changed files with 158 additions and 397 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"phpunit/phpunit" : "^10.0",
"php-coveralls/php-coveralls" : "^2.0",
"symfony/polyfill-mbstring" : "^1.27",
"rector/rector" : "^0.16.0",
"rector/rector" : "^0.18.0",
"vimeo/psalm" : "^5.4.0"
},
"autoload" : {
Expand All @@ -53,7 +53,8 @@
"rector" : "vendor/bin/rector process src --dry-run -vvv",
"rector-clear": "vendor/bin/rector --clear-cache",
"psalm" : "vendor/bin/psalm --threads=1",
"qa" : "composer test && composer rector && composer psalm"
"psalm-clear-cache": "vendor/bin/psalm --clear-global-cache && vendor/bin/psalm --clear-cache",
"qa": "composer test && composer rector && composer psalm-clear-cache && composer psalm"
},
"config" : {
"allow-plugins" : {
Expand Down
36 changes: 14 additions & 22 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,20 @@
$rectorConfigurator->import(SetList::PHP_80);
$rectorConfigurator->import(SetList::PHP_81);
$rectorConfigurator->import(SetList::DEAD_CODE);
$rectorConfigurator->import(SetList::PSR_4);
$rectorConfigurator->import(SetList::TYPE_DECLARATION);

$skipables = [
// \Rector\CodeQuality\Rector\If_\ShortenElseIfRector::class,
// \Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector::class,
// \Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector::class,
// \Rector\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector::class,
// \Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector::class,
// //\Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector::class,
// \Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector::class,
// \Rector\Php71\Rector\FuncCall\CountOnNullRector::class,
// //\Rector\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector::class,
// \Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector::class
];

$rectorConfigurator->skip([
\Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector::class,
//\Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector::class,
\Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector::class,
\Rector\Php71\Rector\FuncCall\CountOnNullRector::class,
//\Rector\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector::class,
\Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector::class
]);

// get parameters
//$parameters = $rectorConfigurator->parameters();

// register a single rule
//$services = $rectorConfigurator->services();
//$services->set(TypedPropertyRector::class);

// get services (needed for register a single rule)
//$services = $rectorConfigurator->services();

//TODO:PHP8 comment once PHP 8 becomes minimum version
//$services->remove(Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector::class);
$rectorConfigurator->skip($skipables);
};
81 changes: 28 additions & 53 deletions src/CollectionInterface.php

Large diffs are not rendered by default.

Loading

0 comments on commit e774737

Please sign in to comment.