coolify/rector.php
peaklabs-dev a4edfaa682
chore(tooling): update and improve rector config
- remove `AddOverrideAttributeToOverriddenPropertiesRector` from `withSkip` as the enum formatting has been fixed
- add `AddOverrideAttributeToOverriddenPropertiesRector` to `withSkip`
- comment out `typeDeclarationDocblocks` as these rules might not be what we want
- add new `WhereNullComparisonToWhereNullRector` rule
- remove `WhereToWhereLikeRector` as we are not only using Postgres on v5
2026-02-24 19:08:16 +01:00

85 lines
3.1 KiB
PHP

<?php
declare(strict_types=1);
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\Config\RectorConfig;
use Rector\Php80\Rector\NotIdentical\MbStrContainsRector;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
use Rector\Php85\Rector\Expression\NestedFuncCallsToPipeOperatorRector;
use Rector\Php85\Rector\Property\AddOverrideAttributeToOverriddenPropertiesRector;
use Rector\Php85\Rector\StmtsAwareInterface\SequentialAssignmentsToPipeOperatorRector;
use RectorLaravel\Rector\Class_\RemoveModelPropertyFromFactoriesRector;
use RectorLaravel\Rector\Empty_\EmptyToBlankAndFilledFuncRector;
use RectorLaravel\Rector\FuncCall\ConfigToTypedConfigMethodCallRector;
use RectorLaravel\Rector\FuncCall\RemoveDumpDataDeadCodeRector;
use RectorLaravel\Rector\MethodCall\WhereNullComparisonToWhereNullRector;
use RectorLaravel\Rector\StaticCall\RequestStaticValidateToInjectRector;
use RectorLaravel\Set\LaravelSetList;
use RectorLaravel\Set\LaravelSetProvider;
return RectorConfig::configure()
->withPaths([
__DIR__.'/app',
__DIR__.'/bootstrap',
__DIR__.'/config',
__DIR__.'/database',
__DIR__.'/public',
__DIR__.'/routes',
__DIR__.'/tests',
])
->withRootFiles()
->withSkip([
__DIR__.'/bootstrap/cache',
AddOverrideAttributeToOverriddenMethodsRector::class,
AddOverrideAttributeToOverriddenPropertiesRector::class,
])
->withCache(__DIR__.'/storage/rector', FileCacheStorage::class)
->withPhpSets()
->withAttributesSets()
->withPreparedSets(
deadCode: true,
codeQuality: true,
codingStyle: true,
typeDeclarations: true,
// typeDeclarationDocblocks: true,
privatization: true,
instanceOf: true,
earlyReturn: true,
carbon: true,
rectorPreset: true,
)
->withSetProviders(LaravelSetProvider::class)
->withComposerBased(laravel: true)
->withSets([
LaravelSetList::LARAVEL_ARRAYACCESS_TO_METHOD_CALL,
LaravelSetList::LARAVEL_ARRAY_STR_FUNCTION_TO_STATIC_CALL,
LaravelSetList::LARAVEL_CODE_QUALITY,
LaravelSetList::LARAVEL_COLLECTION,
LaravelSetList::LARAVEL_CONTAINER_STRING_TO_FULLY_QUALIFIED_NAME,
LaravelSetList::LARAVEL_FACADE_ALIASES_TO_FULL_NAMES,
LaravelSetList::LARAVEL_FACTORIES,
LaravelSetList::LARAVEL_IF_HELPERS,
LaravelSetList::LARAVEL_LEGACY_FACTORIES_TO_CLASSES,
LaravelSetList::LARAVEL_TESTING,
LaravelSetList::LARAVEL_TYPE_DECLARATIONS,
])
->withRules([
// Core Rector Rules
SequentialAssignmentsToPipeOperatorRector::class,
NestedFuncCallsToPipeOperatorRector::class,
MbStrContainsRector::class,
// Laravel Rector Rules
EmptyToBlankAndFilledFuncRector::class,
ConfigToTypedConfigMethodCallRector::class,
RemoveModelPropertyFromFactoriesRector::class,
RequestStaticValidateToInjectRector::class,
WhereNullComparisonToWhereNullRector::class,
])
->withConfiguredRule(RemoveDumpDataDeadCodeRector::class, [
'dd',
'ddd',
'dump',
'ray',
]);