From 468942248dbda56db15d02e4113e8668b904be7c Mon Sep 17 00:00:00 2001 From: kodiakhq Date: Sun, 3 Mar 2024 02:50:29 +0000 Subject: [PATCH] deploy: 38bb9866b6ea71f16ace6bc0e0aa08f9fc707f09 --- files/redaxo-main/rector.php.txt | 83 ++++++++++++++------------------ 1 file changed, 37 insertions(+), 46 deletions(-) diff --git a/files/redaxo-main/rector.php.txt b/files/redaxo-main/rector.php.txt index d01683f1c..4aee5729d 100644 --- a/files/redaxo-main/rector.php.txt +++ b/files/redaxo-main/rector.php.txt @@ -31,14 +31,11 @@ use Redaxo\Rector\Util\UnderscoreCamelCasePropertyRenamer; require_once __DIR__ . '/.tools/rector/autoload.php'; -return static function (RectorConfig $rectorConfig): void { - $rectorConfig->bootstrapFiles([ +return RectorConfig::configure() + ->withBootstrapFiles([ __DIR__ . '/.tools/constants.php', - ]); - - // this list will grow over time. - // to make sure we can review every transformation and not introduce unseen bugs - $rectorConfig->paths([ + ]) + ->withPaths([ // restrict to core and core addons, ignore other locally installed addons 'redaxo/src/core/', 'redaxo/src/addons/backup/', @@ -53,9 +50,8 @@ return static function (RectorConfig $rectorConfig): void { 'redaxo/src/addons/project/', 'redaxo/src/addons/structure/', 'redaxo/src/addons/users/', - ]); - - $rectorConfig->skip([ + ]) + ->withSkip([ 'redaxo/src/core/vendor', 'redaxo/src/addons/backup/vendor', 'redaxo/src/addons/be_style/vendor', @@ -63,40 +59,35 @@ return static function (RectorConfig $rectorConfig): void { 'redaxo/src/addons/phpmailer/vendor', FirstClassCallableRector::class => ['redaxo/src/core/boot.php'], - ]); - - $rectorConfig->parallel(); - - $rectorConfig->phpVersion(PhpVersion::PHP_81); - - // we will grow this rector list step by step. - // after some basic rectors have been enabled we can finally enable whole-sets (when diffs get stable and reviewable) - $rectorConfig->rule(ChangeSwitchToMatchRector::class); - $rectorConfig->rule(CleanupUnneededNullsafeOperatorRector::class); - $rectorConfig->rule(CombinedAssignRector::class); - $rectorConfig->rule(FirstClassCallableRector::class); - $rectorConfig->rule(IfIssetToCoalescingRector::class); - $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); - $rectorConfig->rule(RemoveUnusedVariableInCatchRector::class); - $rectorConfig->rule(SimplifyBoolIdenticalTrueRector::class); - $rectorConfig->rule(SimplifyConditionsRector::class); - $rectorConfig->rule(SimplifyDeMorganBinaryRector::class); - $rectorConfig->rule(SimplifyForeachToCoalescingRector::class); - $rectorConfig->rule(SimplifyIfReturnBoolRector::class); - $rectorConfig->rule(SimplifyRegexPatternRector::class); - $rectorConfig->rule(SingleInArrayToCompareRector::class); - $rectorConfig->rule(StrContainsRector::class); - $rectorConfig->rule(StrEndsWithRector::class); - $rectorConfig->rule(StrStartsWithRector::class); - $rectorConfig->rule(TernaryToNullCoalescingRector::class); - - // Util services for own rules; - $rectorConfig->singleton(UnderscoreCamelCaseConflictingNameGuard::class); - $rectorConfig->singleton(UnderscoreCamelCaseExpectedNameResolver::class); - $rectorConfig->singleton(UnderscoreCamelCasePropertyRenamer::class); + ]) + ->withParallel() + ->withPhpVersion(PhpVersion::PHP_81) + ->registerService(UnderscoreCamelCaseConflictingNameGuard::class) + ->registerService(UnderscoreCamelCaseExpectedNameResolver::class) + ->registerService(UnderscoreCamelCasePropertyRenamer::class) + ->withRules([ + ChangeSwitchToMatchRector::class, + CleanupUnneededNullsafeOperatorRector::class, + CombinedAssignRector::class, + FirstClassCallableRector::class, + IfIssetToCoalescingRector::class, + InlineConstructorDefaultToPropertyRector::class, + RemoveUnusedVariableInCatchRector::class, + SimplifyBoolIdenticalTrueRector::class, + SimplifyConditionsRector::class, + SimplifyDeMorganBinaryRector::class, + SimplifyForeachToCoalescingRector::class, + SimplifyIfReturnBoolRector::class, + SimplifyRegexPatternRector::class, + SingleInArrayToCompareRector::class, + StrContainsRector::class, + StrEndsWithRector::class, + StrStartsWithRector::class, + TernaryToNullCoalescingRector::class, + UnnecessaryTernaryExpressionRector::class, - // Own rules - $rectorConfig->rule(UnderscoreToCamelCasePropertyNameRector::class); - $rectorConfig->rule(UnderscoreToCamelCaseVariableNameRector::class); - $rectorConfig->rule(UnnecessaryTernaryExpressionRector::class); -}; + // Own rules + UnderscoreToCamelCasePropertyNameRector::class, + UnderscoreToCamelCaseVariableNameRector::class, + ]) +;