12 Star 89 Fork 26

guanguans / music-dl

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
rector.php 9.78 KB
一键复制 编辑 原始数据 按行查看 历史
yaozm 提交于 2024-05-23 17:53 . style: apply rector
<?php
declare(strict_types=1);
/**
* Copyright (c) 2019-2024 guanguans<ityaozm@gmail.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://github.com/guanguans/music-dl
*/
// use App\Support\Rectors\RenameToPsrNameRector;
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodeQuality\Rector\LogicalAnd\LogicalToBooleanRector;
use Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector;
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector;
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
use Rector\Config\RectorConfig;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Renaming\Rector\StaticCall\RenameStaticMethodRector;
use Rector\Renaming\Rector\String_\RenameStringRector;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use RectorLaravel\Rector\MethodCall\UseComponentPropertyWithinCommandsRector;
use RectorLaravel\Set\LaravelSetList;
// (function ($rectorConfig): void {
// $rectorConfig->ruleConfigurations[AnnotationToAttributeRector::class] = array_filter(
// $rectorConfig->ruleConfigurations[AnnotationToAttributeRector::class],
// static fn (AnnotationToAttribute $annotationToAttribute): bool => !\in_array(
// $annotationToAttribute->getAttributeClass(),
// [
// CodeCoverageIgnore::class,
// ],
// true
// )
// );
// })->call($rectorConfig, $rectorConfig);
return RectorConfig::configure()
->withPaths([
__DIR__.'/*.php',
__DIR__.'/.*.php',
__DIR__.'/app',
__DIR__.'/composer-updater',
__DIR__.'/config',
__DIR__.'/tests',
])
->withPHPStanConfigs([
__DIR__.'/phpstan.neon',
])
->withParallel()
// ->withoutParallel()
->withImportNames(false)
// ->withDeadCodeLevel(42)
// ->withTypeCoverageLevel(23)
// ->withFluentCallNewLine()
->withPhpSets(php82: true)
->withPreparedSets(
deadCode: true,
codeQuality: true,
codingStyle: true,
typeDeclarations: true,
privatization: true,
naming: true,
instanceOf: true,
earlyReturn: true,
)
->withAttributesSets(
phpunit: true
)
->withSets([
DowngradeLevelSetList::DOWN_TO_PHP_82,
PHPUnitSetList::PHPUNIT_100,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
LaravelSetList::LARAVEL_110,
// LaravelSetList::LARAVEL_STATIC_TO_INJECTION,
LaravelSetList::LARAVEL_CODE_QUALITY,
LaravelSetList::LARAVEL_ARRAY_STR_FUNCTION_TO_STATIC_CALL,
LaravelSetList::LARAVEL_LEGACY_FACTORIES_TO_CLASSES,
LaravelSetList::LARAVEL_FACADE_ALIASES_TO_FULL_NAMES,
LaravelSetList::LARAVEL_ELOQUENT_MAGIC_METHOD_TO_QUERY_BUILDER,
])
->withRules([
// // RectorLaravel\Rector\Assign\CallOnAppArrayAccessToStandaloneAssignRector::class,
// // RectorLaravel\Rector\Cast\DatabaseExpressionCastsToMethodCallRector::class,
RectorLaravel\Rector\ClassMethod\AddParentBootToModelClassMethodRector::class,
RectorLaravel\Rector\ClassMethod\AddParentRegisterToEventServiceProviderRector::class,
RectorLaravel\Rector\ClassMethod\MigrateToSimplifiedAttributeRector::class,
RectorLaravel\Rector\Class_\AddExtendsAnnotationToModelFactoriesRector::class,
RectorLaravel\Rector\Class_\AddMockConsoleOutputFalseToConsoleTestsRector::class,
RectorLaravel\Rector\Class_\AnonymousMigrationsRector::class,
RectorLaravel\Rector\Class_\ModelCastsPropertyToCastsMethodRector::class,
RectorLaravel\Rector\Class_\PropertyDeferToDeferrableProviderToRector::class,
RectorLaravel\Rector\Class_\RemoveModelPropertyFromFactoriesRector::class,
// // RectorLaravel\Rector\Class_\ReplaceExpectsMethodsInTestsRector::class,
// // RectorLaravel\Rector\Class_\UnifyModelDatesWithCastsRector::class,
// RectorLaravel\Rector\Empty_\EmptyToBlankAndFilledFuncRector::class,
RectorLaravel\Rector\Expr\AppEnvironmentComparisonToParameterRector::class,
RectorLaravel\Rector\Expr\SubStrToStartsWithOrEndsWithStaticMethodCallRector\SubStrToStartsWithOrEndsWithStaticMethodCallRector::class,
// // RectorLaravel\Rector\FuncCall\DispatchNonShouldQueueToDispatchSyncRector::class,
// // RectorLaravel\Rector\FuncCall\FactoryFuncCallToStaticCallRector::class,
// RectorLaravel\Rector\FuncCall\HelperFuncCallToFacadeClassRector::class,
RectorLaravel\Rector\FuncCall\NotFilledBlankFuncCallToBlankFilledFuncCallRector::class,
RectorLaravel\Rector\FuncCall\NowFuncWithStartOfDayMethodCallToTodayFuncRector::class,
RectorLaravel\Rector\FuncCall\RemoveDumpDataDeadCodeRector::class,
RectorLaravel\Rector\FuncCall\RemoveRedundantValueCallsRector::class,
RectorLaravel\Rector\FuncCall\RemoveRedundantWithCallsRector::class,
RectorLaravel\Rector\FuncCall\SleepFuncToSleepStaticCallRector::class,
// RectorLaravel\Rector\FuncCall\ThrowIfAndThrowUnlessExceptionsToUseClassStringRector::class,
RectorLaravel\Rector\If_\AbortIfRector::class,
RectorLaravel\Rector\If_\ReportIfRector::class,
// RectorLaravel\Rector\If_\ThrowIfRector::class,
RectorLaravel\Rector\MethodCall\AssertStatusToAssertMethodRector::class,
RectorLaravel\Rector\MethodCall\ChangeQueryWhereDateValueWithCarbonRector::class,
// // RectorLaravel\Rector\MethodCall\DatabaseExpressionToStringToMethodCallRector::class,
RectorLaravel\Rector\MethodCall\EloquentWhereRelationTypeHintingParameterRector::class,
RectorLaravel\Rector\MethodCall\EloquentWhereTypeHintClosureParameterRector::class,
// // RectorLaravel\Rector\MethodCall\FactoryApplyingStatesRector::class,
RectorLaravel\Rector\MethodCall\JsonCallToExplicitJsonCallRector::class,
// RectorLaravel\Rector\MethodCall\LumenRoutesStringActionToUsesArrayRector::class,
// RectorLaravel\Rector\MethodCall\LumenRoutesStringMiddlewareToArrayRector::class,
RectorLaravel\Rector\MethodCall\RedirectBackToBackHelperRector::class,
RectorLaravel\Rector\MethodCall\RedirectRouteToToRouteHelperRector::class,
RectorLaravel\Rector\MethodCall\RefactorBlueprintGeometryColumnsRector::class,
// // RectorLaravel\Rector\MethodCall\ReplaceWithoutJobsEventsAndNotificationsWithFacadeFakeRector::class,
RectorLaravel\Rector\MethodCall\UseComponentPropertyWithinCommandsRector::class,
RectorLaravel\Rector\MethodCall\ValidationRuleArrayStringValueToArrayRector::class,
// // RectorLaravel\Rector\Namespace_\FactoryDefinitionRector::class,
RectorLaravel\Rector\New_\AddGuardToLoginEventRector::class,
RectorLaravel\Rector\PropertyFetch\ReplaceFakerInstanceWithHelperRector::class,
RectorLaravel\Rector\StaticCall\DispatchToHelperFunctionsRector::class,
// RectorLaravel\Rector\StaticCall\MinutesToSecondsInCacheRector::class,
RectorLaravel\Rector\StaticCall\Redirect301ToPermanentRedirectRector::class,
// // RectorLaravel\Rector\StaticCall\ReplaceAssertTimesSendWithAssertSentTimesRector::class,
])
->withRules([
// // RectorLaravel\Rector\ClassMethod\AddArgumentDefaultValueRector::class,
// // RectorLaravel\Rector\FuncCall\ArgumentFuncCallToMethodCallRector::class,
// RectorLaravel\Rector\MethodCall\EloquentOrderByToLatestOrOldestRector::class,
// RectorLaravel\Rector\MethodCall\ReplaceServiceContainerCallArgRector::class,
// RectorLaravel\Rector\PropertyFetch\OptionalToNullsafeOperatorRector::class,
// // RectorLaravel\Rector\StaticCall\EloquentMagicMethodToQueryBuilderRector::class,
// RectorLaravel\Rector\StaticCall\RouteActionCallableRector::class,
])
->withConfiguredRule(RectorLaravel\Rector\MethodCall\EloquentOrderByToLatestOrOldestRector::class, [
])
->withConfiguredRule(RectorLaravel\Rector\MethodCall\ReplaceServiceContainerCallArgRector::class, [
])
->withConfiguredRule(RectorLaravel\Rector\PropertyFetch\OptionalToNullsafeOperatorRector::class, [
])
->withConfiguredRule(RectorLaravel\Rector\StaticCall\RouteActionCallableRector::class, [
])
->withConfiguredRule(RenameFunctionRector::class, [
'test' => 'it',
])
// ->withConfiguredRule(RenameToPsrNameRector::class, [
// '_*',
// ])
->withConfiguredRule(RenameClassRector::class, [
])
->withConfiguredRule(RenameStaticMethodRector::class, [
])
->withConfiguredRule(RenameStringRector::class, [
])
->withSkip([
'**/__snapshots__/*',
'**/Fixtures/*',
__DIR__.'/.phpstorm.meta.php',
__DIR__.'/_ide_helper.php',
__DIR__.'/_ide_helper_models.php',
__DIR__.'/dcat_admin_ide_helper.php',
__DIR__.'/deploy.example.php',
__DIR__.'/deploy.php',
__DIR__.'/rector-dist.php',
__FILE__,
])
->withSkip([
EncapsedStringsToSprintfRector::class,
ExplicitBoolCompareRector::class,
LogicalToBooleanRector::class,
NewlineAfterStatementRector::class,
WrapEncapsedVariableInCurlyBracesRector::class,
])
->withSkip([
UseComponentPropertyWithinCommandsRector::class => [
__DIR__.'/app/Commands/InspireCommand.php',
],
StaticArrowFunctionRector::class => $staticClosureSkipPaths = [
__FILE__,
__DIR__.'/tests',
],
StaticClosureRector::class => $staticClosureSkipPaths,
]);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/guanguans/music-dl.git
git@gitee.com:guanguans/music-dl.git
guanguans
music-dl
music-dl
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891