-
-
Notifications
You must be signed in to change notification settings - Fork 438
/
rector.php
62 lines (60 loc) · 3.4 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
60
61
62
<?php declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\SetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::TYPE_DECLARATION,
SetList::RECTOR_PRESET,
SetList::PHP_72,
SetList::PHP_73,
SetList::PHP_74,
SetList::PHP_80,
PHPUnitSetList::PHPUNIT_60,
PHPUnitSetList::PHPUNIT_70,
PHPUnitSetList::PHPUNIT_80,
PHPUnitSetList::PHPUNIT_90,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
]);
$rectorConfig->rule(Rector\CodingStyle\Rector\Closure\StaticClosureRector::class);
$rectorConfig->skip([
__DIR__ . '/src/Tracing/FederatedTracing/Proto', // Generated code
__DIR__ . '/tests/database/migrations', // Does not fit autoloader standards
__DIR__ . '/tests/LaravelPhpdocAlignmentFixer.php', // Copied from Laravel
Rector\CodeQuality\Rector\Isset_\IssetOnPropertyObjectToPropertyExistsRector::class, // isset() is nice when moving towards typed properties
Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector::class, // Unnecessarily complex with PHPStan
Rector\CodeQuality\Rector\Concat\JoinStringConcatRector::class => [
__DIR__ . '/tests/Integration/OrderBy/OrderByDirectiveTest.php', // Improves clarity
],
Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector::class => [
__DIR__ . '/src/Testing/TestResponseMixin.php', // mixins are weird
],
Rector\CodingStyle\Rector\Closure\StaticClosureRector::class => [
__DIR__ . '/src/Testing/TestResponseMixin.php', // Cannot bind an instance to a static closure
],
Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector::class => [
__DIR__ . '/tests/Unit/Execution/ResolveInfoTest.php', // Makes method public on purpose
__DIR__ . '/benchmarks/QueryBench.php', // setUp serves a double purpose here
],
Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector::class, // if($truthy) is fine and very readable
Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector::class, // unreadable, slow, error prone
Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector::class, // iterable is fine
Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector::class, // inefficient
Rector\PHPUnit\CodeQuality\Rector\Class_\NarrowUnusedSetUpDefinedPropertyRector::class, // falsely removes $this->schema assignments in some tests
Rector\PHPUnit\PHPUnit100\Rector\StmtsAwareInterface\WithConsecutiveRector::class, // messes up our custom withConsecutive replacement
Rector\PHPUnit\PHPUnit60\Rector\ClassMethod\AddDoesNotPerformAssertionToNonAssertingTestRector::class, // does not recognize mockResolver
Rector\Php80\Rector\FunctionLike\MixedTypeRector::class, // removes useful comments
]);
$rectorConfig->paths([
__DIR__ . '/benchmarks',
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/.php-cs-fixer.php',
__DIR__ . '/_ide_helper.php',
__DIR__ . '/rector.php',
]);
$rectorConfig->phpstanConfig(__DIR__ . '/phpstan.neon');
};