Skip to content

Commit

Permalink
Update rector config file
Browse files Browse the repository at this point in the history
  • Loading branch information
guanguans committed Jun 16, 2023
1 parent 44c938e commit 9f4dcbc
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@
use Rector\CodeQuality\Rector\Identical\SimplifyBoolIdenticalTrueRector;
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodeQuality\Rector\LogicalAnd\LogicalToBooleanRector;
use Rector\CodingStyle\Enum\PreferenceSelfThis;
use Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector;
use Rector\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector;
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector;
use Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector;
use Rector\CodingStyle\Rector\MethodCall\PreferThisOrSelfMethodCallRector;
use Rector\Config\RectorConfig;
use Rector\Core\Configuration\Option;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector;
use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector;
use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector;
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryAndToEarlyReturnRector;
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
Expand All @@ -41,9 +38,9 @@
use Rector\PHPUnit\Rector\MethodCall\RemoveExpectAnyFromMockRector;
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->importNames(true, false);
Expand Down Expand Up @@ -89,22 +86,20 @@
// ChangeAndIfToEarlyReturnRector::class,
// ExplicitBoolCompareRector::class,
// RemoveEmptyClassMethodRector::class,
// RemoveEmptyMethodCallRector::class,
// RemoveUnusedVariableAssignRector::class,
// ReturnBinaryOrToEarlyReturnRector::class,
// SimplifyBoolIdenticalTrueRector::class,
// StaticClosureRector::class,
// UnSpreadOperatorRector::class,

ConsistentPregDelimiterRector::class,
EncapsedStringsToSprintfRector::class,
InlineIfToExplicitIfRector::class,
LogicalToBooleanRector::class,
ReturnBinaryAndToEarlyReturnRector::class,
WrapEncapsedVariableInCurlyBracesRector::class,

NormalizeNamespaceByPSR4ComposerAutoloadRector::class => [
__DIR__.'/src/Support/helpers.php',
BooleanInBooleanNotRuleFixerRector::class => [
__DIR__.'/src/Support/EscapeArg.php',
],
RemoveExpectAnyFromMockRector::class => [
__DIR__.'/tests/Concerns/WithDumpableTest.php',
Expand Down Expand Up @@ -139,37 +134,40 @@

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_72,
SetList::ACTION_INJECTION_TO_CONSTRUCTOR_INJECTION,
SetList::PHP_72,
// SetList::ACTION_INJECTION_TO_CONSTRUCTOR_INJECTION,
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SetList::STRICT_BOOLEANS,
// SetList::GMAGICK_TO_IMAGICK,
// SetList::MYSQL_TO_MYSQLI,
SetList::NAMING,
// SetList::PRIVATIZATION,
SetList::PSR_4,
// SetList::PSR_4,
SetList::TYPE_DECLARATION,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,

PHPUnitLevelSetList::UP_TO_PHPUNIT_80,
PHPUnitSetList::PHPUNIT_80,
PHPUnitSetList::PHPUNIT80_DMS,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::PHPUNIT_EXCEPTION,
PHPUnitSetList::REMOVE_MOCKS,
PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD,
PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER,
// PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER,
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
]);

$rectorConfig->rules([
InlineConstructorDefaultToPropertyRector::class,
]);

$rectorConfig->ruleWithConfiguration(
PreferThisOrSelfMethodCallRector::class,
[
TestCase::class => PreferenceSelfThis::PREFER_THIS,
]
);
// $rectorConfig->ruleWithConfiguration(
// PreferThisOrSelfMethodCallRector::class,
// [
// TestCase::class => PreferenceSelfThis::PREFER_THIS,
// ]
// );
};

0 comments on commit 9f4dcbc

Please sign in to comment.