Last active
January 22, 2025 13:57
-
-
Save trovster/b384281ec7e8e66b06a28ad76d2ee20e to your computer and use it in GitHub Desktop.
My current Rector configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector; | |
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector; | |
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector; | |
use Rector\Config\RectorConfig; | |
use Rector\Php81\Rector\Array_\FirstClassCallableRector; | |
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector; | |
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; | |
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector; | |
use RectorLaravel\Rector\If_\AbortIfRector; | |
use RectorLaravel\Set\LaravelSetList; | |
return RectorConfig::configure() | |
->withPaths([ | |
// __DIR__ . '/config', | |
__DIR__ . '/database', | |
__DIR__ . '/app', | |
__DIR__ . '/routes', | |
__DIR__ . '/tests', | |
]) | |
->withSkip([ | |
__DIR__ . '/app/Filament', | |
__DIR__ . '/app/Providers/DocsServiceProvider.php', | |
PrivatizeFinalClassPropertyRector::class => [ | |
__DIR__ . '/app/View/', | |
], | |
PrivatizeFinalClassMethodRector::class => [ | |
__DIR__ . '/app/View/', | |
], | |
FirstClassCallableRector::class => [ | |
__DIR__ . '/routes', | |
__DIR__ . '/app/Http/Controller', | |
], | |
DeclareStrictTypesRector::class => [ | |
__DIR__ . '/config', | |
__DIR__ . '/database', | |
__DIR__ . '/app', | |
__DIR__ . '/routes', | |
], | |
]) | |
->withRootFiles() | |
->withImportNames(importNames: true, importDocBlockNames: false, removeUnusedImports: true) | |
->withPhpSets(php82: true) | |
->withPreparedSets(codingStyle: true, privatization: true) | |
->withAttributesSets() | |
->withCodeQualityLevel(100) | |
->withTypeCoverageLevel(100) | |
->withDeadCodeLevel(100) | |
->withSets([ | |
LaravelSetList::LARAVEL_110, | |
LaravelSetList::LARAVEL_CODE_QUALITY, | |
LaravelSetList::LARAVEL_COLLECTION, | |
LaravelSetList::LARAVEL_LEGACY_FACTORIES_TO_CLASSES, | |
LaravelSetList::LARAVEL_ELOQUENT_MAGIC_METHOD_TO_QUERY_BUILDER, | |
LaravelSetList::LARAVEL_FACADE_ALIASES_TO_FULL_NAMES, | |
LaravelSetList::LARAVEL_ARRAYACCESS_TO_METHOD_CALL, | |
LaravelSetList::LARAVEL_ARRAY_STR_FUNCTION_TO_STATIC_CALL, | |
// LaravelSetList::LARAVEL_FACADE_ALIASES_TO_FULL_NAMES | |
LaravelSetList::LARAVEL_CONTAINER_STRING_TO_FULLY_QUALIFIED_NAME, | |
]) | |
->withRules([ | |
DeclareStrictTypesRector::class, | |
AbortIfRector::class, | |
]) | |
->withSkip([ | |
EncapsedStringsToSprintfRector::class, | |
NewlineAfterStatementRector::class, | |
CatchExceptionNameMatchingTypeRector::class, | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment