Installs rector/rector ^2.0 (v2.4.2) + driftingly/rector-laravel ^2.0 as dev-dependencies. Configures PHP 8.2 language sets + safe quality rule sets (CODE_QUALITY, DEAD_CODE, EARLY_RETURN, TYPE_DECLARATION, PRIVATIZATION) + Laravel-specific sets (LARAVEL_CODE_QUALITY, LARAVEL_COLLECTION). Dry-run baseline: 487 rule-applications across 357 files. NO changes applied in this commit — adoption is incremental via per- set sprints documented in BACKLOG.md. Top rules by volume: 103 AddClosureVoidReturnTypeWhereNoReturnRector 71 AddArrowFunctionReturnTypeRector 51 AppToResolveRector 34 ConvertStaticToSelfRector 27 ReadOnlyClassRector 18 NullToStrictStringFuncCallArgRector 16 ReturnBinaryOrToEarlyReturnRector 16 MakeModelAttributesAndScopesProtectedRector 13 RemoveUnusedVariableAssignRector 13 OptionalToNullsafeOperatorRector 13 FlipTypeControlToUseExclusiveTypeRector Composer scripts: - composer rector — DRY-RUN (default) - composer rector:apply — apply changes - composer rector:clear-cache — clear Rector cache Dry-run exits with code 2 when suggestions exist (Rector convention, not an error state). Apply-mode exits 0 on clean runs. Documentation: /dev-docs/RECTOR.md added; CLAUDE.md updated. Backlog: per-set application sprints seeded (TECH-RECTOR-01..05 + TECH-RECTOR-CI). DEAD_CODE (smallest scope) and TYPE_DECLARATION (biggest volume, will help reduce Larastan baseline) are the natural first two. Disruptive sets deliberately deferred: - LaravelLevelSetList::UP_TO_LARAVEL_* — broad bulk upgrades - SetList::NAMING — high-churn variable renames - SetList::INSTANCEOF — substantial logic changes Memory limit 2G (dry-run completed within it). No production behavior change. No code modified — Rector ran dry-run only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
41 lines
968 B
PHP
41 lines
968 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Rector\Config\RectorConfig;
|
|
use Rector\Set\ValueObject\SetList;
|
|
use RectorLaravel\Set\LaravelSetList;
|
|
|
|
return RectorConfig::configure()
|
|
->withPaths([
|
|
__DIR__ . '/app',
|
|
__DIR__ . '/database',
|
|
__DIR__ . '/tests',
|
|
])
|
|
->withSkip([
|
|
__DIR__ . '/bootstrap/cache',
|
|
__DIR__ . '/storage',
|
|
__DIR__ . '/vendor',
|
|
])
|
|
// PHP language-level upgrades up to current target
|
|
->withPhpSets(php82: true)
|
|
|
|
// Quality + safety rule sets (low-risk for adoption)
|
|
->withSets([
|
|
SetList::CODE_QUALITY,
|
|
SetList::DEAD_CODE,
|
|
SetList::EARLY_RETURN,
|
|
SetList::TYPE_DECLARATION,
|
|
SetList::PRIVATIZATION,
|
|
])
|
|
|
|
// Laravel-specific rule sets
|
|
->withSets([
|
|
LaravelSetList::LARAVEL_CODE_QUALITY,
|
|
LaravelSetList::LARAVEL_COLLECTION,
|
|
])
|
|
|
|
->withCache(
|
|
cacheDirectory: __DIR__ . '/storage/app/rector-cache',
|
|
);
|