Created
July 24, 2025 08:43
-
-
Save WatheqAlshowaiter/f56a43b092b8811cd6969ae8855a2afa to your computer and use it in GitHub Desktop.
My rector configs for laravel
This file contains hidden or 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\Config\RectorConfig; | |
| use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector; | |
| use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; | |
| use Rector\Strict\Rector\Ternary\DisallowedShortTernaryRuleFixerRector; | |
| use Rector\TypeDeclaration\Rector\Closure\AddClosureVoidReturnTypeWhereNoReturnRector; | |
| use Rector\TypeDeclaration\Rector\Function_\AddFunctionVoidReturnTypeWhereNoReturnRector; | |
| use RectorLaravel\Rector\MethodCall\ReplaceServiceContainerCallArgRector; | |
| use RectorLaravel\Set\LaravelLevelSetList; | |
| use RectorLaravel\Set\LaravelSetList; | |
| return RectorConfig::configure() | |
| ->withPaths([ | |
| __DIR__.'/app', | |
| __DIR__.'/bootstrap/app.php', | |
| __DIR__.'/database', | |
| __DIR__.'/public', | |
| ]) | |
| ->withPhpSets(php83: true) // choose you php version | |
| ->withPreparedSets( | |
| deadCode: true, | |
| codeQuality: true, | |
| codingStyle: true, | |
| typeDeclarations: true, | |
| privatization: true, | |
| instanceOf: true, | |
| earlyReturn: true, | |
| strictBooleans: true, | |
| carbon: true, | |
| phpunitCodeQuality: true, | |
| ) | |
| ->withSkip([ | |
| ClosureToArrowFunctionRector::class, | |
| DisallowedShortTernaryRuleFixerRector::class, | |
| CatchExceptionNameMatchingTypeRector::class, | |
| EncapsedStringsToSprintfRector::class, | |
| ReplaceServiceContainerCallArgRector::class, | |
| AddClosureVoidReturnTypeWhereNoReturnRector::class, | |
| AddFunctionVoidReturnTypeWhereNoReturnRector::class, | |
| NullToStrictStringFuncCallArgRector::class, | |
| ]) | |
| ->withSets([ | |
| LaravelLevelSetList::UP_TO_LARAVEL_120, | |
| LaravelSetList::LARAVEL_CODE_QUALITY, | |
| LaravelSetList::LARAVEL_ARRAY_STR_FUNCTION_TO_STATIC_CALL, | |
| LaravelSetList::LARAVEL_ARRAYACCESS_TO_METHOD_CALL, | |
| LaravelSetList::LARAVEL_COLLECTION, | |
| LaravelSetList::LARAVEL_CONTAINER_STRING_TO_FULLY_QUALIFIED_NAME, | |
| LaravelSetList::LARAVEL_ELOQUENT_MAGIC_METHOD_TO_QUERY_BUILDER, | |
| LaravelSetList::LARAVEL_FACADE_ALIASES_TO_FULL_NAMES, | |
| LaravelSetList::LARAVEL_LEGACY_FACTORIES_TO_CLASSES, | |
| ]) | |
| ->withImportNames(removeUnusedImports: true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment