-
Notifications
You must be signed in to change notification settings - Fork 262
Expand file tree
/
Copy pathrector.php
More file actions
56 lines (54 loc) · 2.17 KB
/
rector.php
File metadata and controls
56 lines (54 loc) · 2.17 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
<?php
use PhpParser\Node\Expr\Cast\Bool_;
use PhpParser\Node\Expr\Cast\Double;
use PhpParser\Node\Expr\Cast\Int_;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassLike\RemoveAnnotationRector;
use Rector\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\Class_\StringableForToStringRector;
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
use Rector\Renaming\Rector\Cast\RenameCastRector;
use Rector\Renaming\ValueObject\RenameCast;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/examples',
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/tools',
])
// Error with StaticCallOnNonStaticToInstanceCallRector
// https://github.com/rectorphp/rector/issues/9608
->withSkipPath(__DIR__ . '/tests/Builder/BuilderEncoderTest.php')
->withPhpSets(php80: true)
->withComposerBased(phpunit: true)
->withRules([
ChangeSwitchToMatchRector::class,
])
// All classes are public API by default, unless marked with @internal.
->withConfiguredRule(RemoveAnnotationRector::class, ['api'])
// Fix PHP 8.5 deprecations
->withConfiguredRule(
RenameCastRector::class,
[
new RenameCast(Int_::class, Int_::KIND_INTEGER, Int_::KIND_INT),
new RenameCast(Bool_::class, Bool_::KIND_BOOLEAN, Bool_::KIND_BOOL),
new RenameCast(Double::class, Double::KIND_DOUBLE, Double::KIND_FLOAT),
],
)
// phpcs:disable Squiz.Arrays.ArrayDeclaration.KeySpecified
->withSkip([
RemoveExtraParametersRector::class,
// Do not use ternaries extensively
IfIssetToCoalescingRector::class,
ChangeSwitchToMatchRector::class => [
__DIR__ . '/tests/SpecTests/Operation.php',
],
ClassPropertyAssignToConstructorPromotionRector::class,
StringableForToStringRector::class => [
__DIR__ . '/src/Model/IndexInput.php',
],
])
// phpcs:enable
->withImportNames(importNames: false, removeUnusedImports: true);