Skip to content

Instantly share code, notes, and snippets.

@0x1881
Created April 4, 2026 22:32
Show Gist options
  • Select an option

  • Save 0x1881/e4ea43de1da9736a01ce6974b989aa5c to your computer and use it in GitHub Desktop.

Select an option

Save 0x1881/e4ea43de1da9736a01ce6974b989aa5c to your computer and use it in GitHub Desktop.
rectorphp config for laravel 12-13 + php 8.5
<?php
declare(strict_types=1);
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\SetList;
use Rector\ValueObject\PhpVersion;
use RectorLaravel\Set\LaravelLevelSetList;
use RectorLaravel\Set\LaravelSetList;
use RectorLaravel\Set\LaravelSetProvider;
return RectorConfig::configure()
->withSetProviders(LaravelSetProvider::class)
->withComposerBased(laravel: true)
->withPaths([
__DIR__.'/app',
__DIR__.'/config',
__DIR__.'/database',
__DIR__.'/lang',
__DIR__.'/resources',
__DIR__.'/routes',
])
->withCache(cacheDirectory: __DIR__.'/storage/rector', cacheClass: FileCacheStorage::class)
->withSets([
// LaravelSetList::LARAVEL_STATIC_TO_INJECTION //
// LaravelSetList::LARAVEL_ELOQUENT_MAGIC_METHOD_TO_QUERY_BUILDER, //
// LaravelSetList::LARAVEL_TYPE_DECLARATIONS, //
// SetList::TYPE_DECLARATION_DOCBLOCKS, //
// SetList::TYPE_DECLARATION, //
// SetList::NAMING, //
LaravelLevelSetList::UP_TO_LARAVEL_120,
LaravelSetList::LARAVEL_130,
LaravelSetList::LARAVEL_CODE_QUALITY,
LaravelSetList::LARAVEL_IF_HELPERS,
LaravelSetList::LARAVEL_COLLECTION,
LaravelSetList::ARRAY_STR_FUNCTIONS_TO_STATIC_CALL,
LaravelSetList::LARAVEL_TYPE_DECLARATIONS,
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SetList::INSTANCEOF,
SetList::TYPE_DECLARATION_DOCBLOCKS,
])
->withImportNames(
importNames: false,
removeUnusedImports: true
)
->withAttributesSets(all: true)
->withPhpSets(
php85: true
)
->withPhpVersion(PhpVersion::PHP_85);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment