-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
80 lines (71 loc) · 2.48 KB
/
rector.php
File metadata and controls
80 lines (71 loc) · 2.48 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
* This file is part of the package magicsunday/webtrees-module-base.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\DeadCode\Rector\Stmt\RemoveUnreachableStatementRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src/',
__DIR__ . '/tests/',
]);
if (
!is_dir($concurrentDirectory = __DIR__ . '/.build/cache/.rector.cache')
&& !mkdir($concurrentDirectory, 0775, true)
&& !is_dir($concurrentDirectory)
) {
throw new \RuntimeException(
sprintf(
'Directory "%s" was not created',
$concurrentDirectory
)
);
}
if (
!is_dir($concurrentDirectory = __DIR__ . '/.build/cache/.rector.container.cache')
&& !mkdir($concurrentDirectory, 0775, true)
&& !is_dir($concurrentDirectory)
) {
throw new \RuntimeException(
sprintf(
'Directory "%s" was not created',
$concurrentDirectory
)
);
}
$rectorConfig->phpstanConfig(__DIR__ . '/phpstan.neon');
$rectorConfig->importNames();
$rectorConfig->removeUnusedImports();
$rectorConfig->disableParallel();
$rectorConfig->cacheDirectory(__DIR__ . '/.build/cache/.rector.cache');
$rectorConfig->containerCacheDirectory(__DIR__ . '/.build/cache/.rector.container.cache');
$rectorConfig->phpVersion(80300);
// Define what rule sets will be applied
$rectorConfig->sets([
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
SetList::PRIVATIZATION,
SetList::TYPE_DECLARATION,
SetList::TYPE_DECLARATION_DOCBLOCKS,
LevelSetList::UP_TO_PHP_83,
]);
// Skip some rules
$rectorConfig->skip([
CatchExceptionNameMatchingTypeRector::class,
RemoveUnreachableStatementRector::class,
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class,
]);
};