Skip to content

Commit 7c607cb

Browse files
committed
Add Rector configuration
1 parent 8a11b6b commit 7c607cb

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

rector.php

+16-17
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,32 @@
88
use Rector\Php74\Rector\Assign\NullCoalescingOperatorRector;
99
use Rector\Php74\Rector\Property\TypedPropertyRector;
1010
use Rector\Set\ValueObject\LevelSetList;
11+
use Rector\Set\ValueObject\SetList;
1112
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
12-
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
13-
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
1413
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
15-
use Rector\TypeDeclaration\Rector\Property\AddPropertyTypeDeclarationRector;
1614

17-
return static function(RectorConfig $rectorConfig): void {
18-
$rectorConfig->paths([
15+
return static function(RectorConfig $config): void {
16+
$config->paths([
1917
__DIR__ . '/src'
2018
]);
2119

22-
// register a single rule
23-
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
24-
$rectorConfig->rule(NullCoalescingOperatorRector::class);
25-
$rectorConfig->rule(RemoveExtraParametersRector::class);
26-
27-
$rectorConfig->rule(AddMethodCallBasedStrictParamTypeRector::class);
28-
$rectorConfig->rule(AddVoidReturnTypeWhereNoReturnRector::class);
20+
$config->import(SetList::DEAD_CODE);
21+
$config->import(SetList::TYPE_DECLARATION_STRICT);
22+
$config->import(SetList::TYPE_DECLARATION);
23+
$config->import(SetList::PHP_80);
24+
$config->import(SetList::PHP_74);
25+
$config->import(SetList::PHP_73);
26+
$config->import(SetList::EARLY_RETURN);
27+
$config->import(SetList::CODE_QUALITY);
2928

30-
$rectorConfig->ruleWithConfiguration(TypedPropertyRector::class, [
31-
TypedPropertyRector::INLINE_PUBLIC => true,
32-
]);
29+
// register a single rule
30+
$config->rule(InlineConstructorDefaultToPropertyRector::class);
31+
$config->rule(RemoveExtraParametersRector::class);
3332

3433
// define sets of rules
35-
$rectorConfig->sets([
34+
$config->sets([
3635
LevelSetList::UP_TO_PHP_80
3736
]);
3837

39-
$rectorConfig->phpstanConfig(__DIR__ . '/phpstan.neon');
38+
$config->phpstanConfig(__DIR__ . '/phpstan.neon');
4039
};

0 commit comments

Comments
 (0)