-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
69 lines (56 loc) · 2.08 KB
/
Copy pathrector.php
File metadata and controls
69 lines (56 loc) · 2.08 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
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\CodeQuality\Rector\ClassMethod\LocallyCalledStaticMethodToNonStaticRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
return static function (RectorConfig $rectorConfig): void {
// Paths to refactor
$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);
// Skip vendor and generated files
$rectorConfig->skip([
__DIR__ . '/vendor',
__DIR__ . '/tests/fixtures/cassettes',
]);
// PHP version and sets
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_81,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
SetList::TYPE_DECLARATION,
SetList::EARLY_RETURN,
]);
// Custom rules for financial SDK
$rectorConfig->rules([
// Add void return types where appropriate
AddVoidReturnTypeWhereNoReturnRector::class,
// Use constructor property promotion
InlineConstructorDefaultToPropertyRector::class,
// Remove unnecessary PHPDoc tags
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class,
// PHP 8.1 features
ReadOnlyPropertyRector::class,
]);
// Skip factory methods from static method conversion
$rectorConfig->skip([
LocallyCalledStaticMethodToNonStaticRector::class => [
__DIR__ . '/src/Factory/VatRetrievalClientFactory.php',
],
]);
// Parallel processing
$rectorConfig->parallel();
// Cache directory
$rectorConfig->cacheDirectory(__DIR__ . '/var/rector');
// Import names
$rectorConfig->importNames();
$rectorConfig->importShortClasses(false);
};