Skip to content

Commit

Permalink
deploy: 38bb986
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq committed Mar 3, 2024
1 parent 22a9ed5 commit 4689422
Showing 1 changed file with 37 additions and 46 deletions.
83 changes: 37 additions & 46 deletions files/redaxo-main/rector.php.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/',
Expand All @@ -53,50 +50,44 @@ 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',
'redaxo/src/addons/debug/vendor',
'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,
])
;

0 comments on commit 4689422

Please sign in to comment.