Repository navigation
Expand file tree
/
Copy pathrector.php
More file actions
79 lines (74 loc) · 3.82 KB
/
Copy pathrector.php
File metadata and controls
79 lines (74 loc) · 3.82 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
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\BooleanAnd\RepeatedAndNotEqualToNotInArrayRector;
use Rector\CodeQuality\Rector\BooleanNot\NegatedAndsToPositiveOrsRector;
use Rector\CodeQuality\Rector\BooleanOr\RepeatedOrEqualToInArrayRector;
use Rector\CodeQuality\Rector\ClassMethod\LocallyCalledStaticMethodToNonStaticRector;
use Rector\CodeQuality\Rector\Equal\UseIdenticalOverEqualWithSameTypeRector;
use Rector\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector;
use Rector\CodeQuality\Rector\If_\ObjectExplicitBoolCompareRector;
use Rector\CodingStyle\Rector\FuncCall\FunctionFirstClassCallableRector;
use Rector\Config\RectorConfig;
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
use Rector\EarlyReturn\Rector\StmtsAwareInterface\ReturnEarlyIfVariableRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Php82\Rector\Class_\ReadOnlyClassRector;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
use Rector\PHPUnit\PHPUnit100\Rector\Class_\ParentTestClassConstructorRector;
use Rector\PHPUnit\PHPUnit120\Rector\CallLike\CreateStubOverCreateMockArgRector;
use Rector\PHPUnit\PHPUnit120\Rector\Class_\PropertyCreateMockToCreateStubRector;
use Rector\PHPUnit\PHPUnit120\Rector\ClassMethod\ExpressionCreateMockToCreateStubRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\ValueObject\PhpVersion;
use Rector\Set\ValueObject\SetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_83);
$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);
$rectorConfig->sets([
SetList::PHP_81,
SetList::PHP_82,
SetList::CODE_QUALITY,
PHPUnitSetList::COMPOSER_BASED,
]);
$rectorConfig->rule(AddOverrideAttributeToOverriddenMethodsRector::class);
$rectorConfig->skip([
FlipTypeControlToUseExclusiveTypeRector::class,
ReadOnlyPropertyRector::class => [
__DIR__ . '/src/SDK/Metrics/Stream/SynchronousMetricStream.php',
__DIR__ . '/tests/Unit/Extension/Propagator',
],
ReadOnlyClassRector::class, // a class may need a mutable property later
LocallyCalledStaticMethodToNonStaticRector::class,
ObjectExplicitBoolCompareRector::class,
RepeatedOrEqualToInArrayRector::class,
RepeatedAndNotEqualToNotInArrayRector::class,
NegatedAndsToPositiveOrsRector::class,
ReturnEarlyIfVariableRector::class,
ChangeIfElseValueAssignToEarlyReturnRector::class,
ParentTestClassConstructorRector::class, // misfires on test classes, breaking phpunit
FunctionFirstClassCallableRector::class => [
__DIR__ . '/src/Context/DebugScope.php',
],
UseIdenticalOverEqualWithSameTypeRector::class => [
__DIR__ . '/src/SDK/Metrics/Stream', // bitwise ops on int|GMP yield GMP, never identical to int
],
// misses expectations set on the doubles in another method
CreateStubOverCreateMockArgRector::class => [
__DIR__ . '/tests/Unit/SDK/Logs/Processor/MultiLogRecordProcessorTest.php',
__DIR__ . '/tests/Unit/SDK/Trace/SpanProcessor/MultiSpanProcessorTest.php',
],
// assertEquals() against createMock() doubles fails once these become stubs
ExpressionCreateMockToCreateStubRector::class => [
__DIR__ . '/tests/Unit/SDK/Trace/SpanProcessor/MultiSpanProcessorTest.php',
],
// types the property as Stub&FinalClass, which PHPStan can't resolve
PropertyCreateMockToCreateStubRector::class => [
__DIR__ . '/tests/Unit/SDK/Trace/ImmutableSpanTest.php',
__DIR__ . '/tests/Unit/SDK/Trace/TracerSharedStateTest.php',
__DIR__ . '/tests/Unit/SDK/Trace/TracerTest.php',
],
]);
};