-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
rector.php
59 lines (50 loc) · 2.38 KB
/
rector.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\ClassMethod\ExplicitReturnNullRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
use Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
use Rector\DeadCode\Rector\Stmt\RemoveUnreachableStatementRector;
use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\ValueObject\PhpVersion;
return RectorConfig::configure()
->withPaths([__DIR__ . '/app', __DIR__ . '/modules', __DIR__ . '/tests', __DIR__ . '/public'])
->withBootstrapFiles([__DIR__ . '/vendor/codeigniter4/framework/system/Test/bootstrap.php'])
->withPhpVersion(PhpVersion::PHP_83)
->withPhpSets(php83: true)
->withPreparedSets(
typeDeclarations: true,
codeQuality: true,
codingStyle: true,
earlyReturn: true,
deadCode: true,
)
->withImportNames(true, true, true, true)
->withSkip([
// .mp3 files were somehow processed by rector, so skip all media files
__DIR__ . '/public/media/*',
__DIR__ . '/app/Views/errors/*',
// skip specific generated files
__DIR__ . '/modules/Admin/Language/*/PersonsTaxonomy.php',
// skip rules from used sets
ChangeOrIfContinueToMultiContinueRector::class,
EncapsedStringsToSprintfRector::class,
RemoveExtraParametersRector::class,
UnwrapFutureCompatibleIfPhpVersionRector::class,
ExplicitReturnNullRector::class,
// skip rule in specific directory
StringClassNameToClassConstantRector::class => [
__DIR__ . '/app/Language/*',
__DIR__ . '/modules/*/Language/*',
],
SymplifyQuoteEscapeRector::class => [__DIR__ . '/app/Language/*', __DIR__ . '/modules/*/Language/*'],
NewlineAfterStatementRector::class => [__DIR__ . '/app/Views'],
RemoveUnreachableStatementRector::class => [
__DIR__ . '/modules/Install/Controllers/InstallController.php',
],
])
->withPHPStanConfigs([__DIR__ . '/phpstan.neon', 'vendor/codeigniter/phpstan-codeigniter/extension.neon']);