code-quality/config/rector.php

91 lines
5.2 KiB
PHP
Raw Normal View History

2022-10-12 17:46:05 +00:00
<?php declare(strict_types=1);
use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
use Rector\CodeQuality\Rector\BooleanNot\ReplaceMultipleBooleanNotRector;
use Rector\CodeQuality\Rector\Catch_\ThrowWithPreviousExceptionRector;
use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector;
2022-12-12 19:01:10 +00:00
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
2022-10-12 17:46:05 +00:00
use Rector\CodeQuality\Rector\FuncCall\InlineIsAInstanceOfRector;
use Rector\CodeQuality\Rector\Identical\BooleanNotIdenticalToNotIdenticalRector;
use Rector\CodeQuality\Rector\Identical\SimplifyConditionsRector;
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector;
use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\CodingStyle\Rector\If_\NullableCompareToNullRector;
use Rector\Config\RectorConfig;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
2023-09-01 05:52:22 +00:00
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
2022-10-12 17:46:05 +00:00
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
use Rector\EarlyReturn\Rector\StmtsAwareInterface\ReturnEarlyIfVariableRector;
2022-12-12 19:01:10 +00:00
use Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector;
2022-10-12 17:46:05 +00:00
use Rector\Set\ValueObject\LevelSetList;
use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
2022-12-12 19:01:10 +00:00
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeFromPropertyTypeRector;
2022-10-12 17:46:05 +00:00
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationBasedOnParentClassMethodRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
2022-12-12 19:01:10 +00:00
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnDirectArrayRector;
2022-10-12 17:46:05 +00:00
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictBoolReturnExprRector;
2022-12-12 19:01:10 +00:00
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictConstantReturnRector;
2022-10-12 17:46:05 +00:00
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNativeCallRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector;
2022-12-12 19:01:10 +00:00
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector;
2022-10-12 17:46:05 +00:00
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector;
2022-12-12 19:01:10 +00:00
use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector;
use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector;
2022-10-12 17:46:05 +00:00
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector;
return RectorConfig::configure()
->withSets([LevelSetList::UP_TO_PHP_83])
->withRules([
2022-10-12 17:46:05 +00:00
AddArrowFunctionReturnTypeRector::class,
AddMethodCallBasedStrictParamTypeRector::class,
2022-12-12 19:01:10 +00:00
AddParamTypeFromPropertyTypeRector::class,
AddParamTypeSplFixedArrayRector::class,
2022-10-12 17:46:05 +00:00
AddReturnTypeDeclarationBasedOnParentClassMethodRector::class,
2022-12-12 19:01:10 +00:00
AddReturnTypeDeclarationFromYieldsRector::class,
2022-10-12 17:46:05 +00:00
BooleanNotIdenticalToNotIdenticalRector::class,
ChangeAndIfToEarlyReturnRector::class,
ChangeNestedForeachIfsToEarlyContinueRector::class,
ChangeNestedIfsToEarlyReturnRector::class,
ChangeOrIfContinueToMultiContinueRector::class,
2022-12-12 19:01:10 +00:00
ClassOnThisVariableObjectRector::class,
2022-10-12 17:46:05 +00:00
CountArrayToEmptyArrayComparisonRector::class,
ExplicitBoolCompareRector::class,
InlineArrayReturnAssignRector::class,
InlineIsAInstanceOfRector::class,
NewlineBeforeNewAssignSetRector::class,
NullableCompareToNullRector::class,
ParamTypeByMethodCallTypeRector::class,
ParamTypeByParentCallTypeRector::class,
PreparedValueToEarlyReturnRector::class,
ReplaceMultipleBooleanNotRector::class,
ReturnBinaryOrToEarlyReturnRector::class,
ReturnEarlyIfVariableRector::class,
2022-12-12 19:01:10 +00:00
ReturnTypeFromReturnDirectArrayRector::class,
2022-10-12 17:46:05 +00:00
ReturnTypeFromReturnNewRector::class,
ReturnTypeFromStrictBoolReturnExprRector::class,
2022-12-12 19:01:10 +00:00
ReturnTypeFromStrictConstantReturnRector::class,
2022-10-12 17:46:05 +00:00
ReturnTypeFromStrictNativeCallRector::class,
ReturnTypeFromStrictNewArrayRector::class,
2022-12-12 19:01:10 +00:00
ReturnTypeFromStrictTypedCallRector::class,
2022-10-12 17:46:05 +00:00
ReturnTypeFromStrictTypedPropertyRector::class,
SimplifyConditionsRector::class,
SimplifyEmptyArrayCheckRector::class,
2022-12-12 19:01:10 +00:00
SimplifyEmptyCheckOnEmptyArrayRector::class,
2022-10-12 17:46:05 +00:00
StaticArrowFunctionRector::class,
StaticClosureRector::class,
ThrowWithPreviousExceptionRector::class,
TypedPropertyFromStrictConstructorRector::class,
2023-09-01 05:52:22 +00:00
RemoveAlwaysElseRector::class,
])
;