-
Notifications
You must be signed in to change notification settings - Fork 1
/
rector.php
55 lines (48 loc) · 2.87 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
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
// uncomment to reach your current PHP version
->withPhpVersion(Rector\ValueObject\PhpVersion::PHP_83)
->withPhpSets()
->withPreparedSets(
codingStyle: true,
codeQuality: true,
earlyReturn: true,
typeDeclarations: true,
// strictBooleans: true,
rectorPreset: true,
)
->withConfiguredRule(Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector::class, [
new Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration('ArrayAccess', 'offsetExists', new PHPStan\Type\BooleanType()),
new Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration('ArrayAccess', 'offsetSet', new PHPStan\Type\VoidType()),
new Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration('ArrayAccess', 'offsetUnset', new PHPStan\Type\VoidType()),
])
->withRules([
// // Early returns
// Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector::class,
// Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector::class,
// Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector::class,
// Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector::class,
// Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector::class,
// Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector::class,
// // Strict types
// Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector::class,
// // TypeDeclaration
// Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector::class,
// Rector\Transform\Rector\ClassMethod\ReturnTypeWillChangeRector::class,
// Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationBasedOnParentClassMethodRector::class,
// Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector::class,
// Rector\TypeDeclaration\Rector\ClassMethod\AddTypeFromResourceDocblockRector::class,
// Rector\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromStrictScalarReturnsRector::class,
// Rector\TypeDeclaration\Rector\ClassMethod\NumericReturnTypeFromStrictScalarReturnsRector::class,
// Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnCastRector::class,
// Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnDirectArrayRector::class,
// Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector::class,
// Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictBoolReturnExprRector::class,
// Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictConstantReturnRector::class,
]);