Skip to content

Commit 6122097

Browse files
authored
Merge pull request #59 from kenjis/update-rector-0.15.1
Update rector to 0.15.1
2 parents 47d1968 + 786ef69 commit 6122097

File tree

6 files changed

+43
-9
lines changed

6 files changed

+43
-9
lines changed

.github/workflows/rector.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ jobs:
6262
6363
- name: Analyze for refactoring
6464
run: |
65-
composer global require --dev rector/rector:^0.15.0
65+
composer global require --dev rector/rector:^0.15.1
6666
rector process --dry-run --no-progress-bar

.php-cs-fixer.dist.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
__DIR__ . '/src/',
1111
])
1212
->exclude('build')
13-
->append([__FILE__]);
13+
->append([
14+
__FILE__,
15+
__DIR__ . '/rector.php',
16+
]);
1417

1518
$overrides = [];
1619

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"require-dev": {
4040
"codeigniter4/framework": "^4.1",
4141
"icanhazstring/composer-unused": "^0.8.2",
42-
"rector/rector": "0.15.0"
42+
"rector/rector": "0.15.1"
4343
},
4444
"minimum-stability": "dev",
4545
"prefer-stable": true,

rector.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
4+
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
45
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
56
use Rector\CodeQuality\Rector\For_\ForToForeachRector;
67
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
@@ -30,14 +31,22 @@
3031
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
3132
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
3233
use Rector\PHPUnit\Set\PHPUnitSetList;
34+
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
3335
use Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector;
3436
use Rector\Set\ValueObject\LevelSetList;
3537
use Rector\Set\ValueObject\SetList;
3638
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
3739

3840
return static function (RectorConfig $rectorConfig): void {
39-
$rectorConfig->sets([SetList::DEAD_CODE, LevelSetList::UP_TO_PHP_74, PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, PHPUnitSetList::PHPUNIT_80]);
41+
$rectorConfig->sets([
42+
SetList::DEAD_CODE,
43+
LevelSetList::UP_TO_PHP_74,
44+
PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD,
45+
PHPUnitSetList::PHPUNIT_100,
46+
]);
47+
4048
$rectorConfig->parallel();
49+
4150
// The paths to refactor (can also be supplied with CLI arguments)
4251
$rectorConfig->paths([
4352
__DIR__ . '/src/',
@@ -78,7 +87,7 @@
7887
__DIR__ . '/tests',
7988
],
8089

81-
// Ignore files that should not be namespaced
90+
// Ignore files that should not be namespaced to their folder
8291
NormalizeNamespaceByPSR4ComposerAutoloadRector::class => [
8392
__DIR__ . '/src/Helpers',
8493
],
@@ -89,6 +98,10 @@
8998
// May be uninitialized on purpose
9099
AddDefaultValueForUndefinedVariableRector::class,
91100
]);
101+
102+
// auto import fully qualified class names
103+
$rectorConfig->importNames();
104+
92105
$rectorConfig->rule(SimplifyUselessVariableRector::class);
93106
$rectorConfig->rule(RemoveAlwaysElseRector::class);
94107
$rectorConfig->rule(CountArrayToEmptyArrayComparisonRector::class);
@@ -116,4 +129,7 @@
116129
// Set to false if you use in libraries, or it does create breaking changes.
117130
TypedPropertyFromAssignsRector::INLINE_PUBLIC => true,
118131
]);
132+
$rectorConfig->rule(StringClassNameToClassConstantRector::class);
133+
$rectorConfig->rule(PrivatizeFinalClassPropertyRector::class);
134+
$rectorConfig->rule(CompleteDynamicPropertiesRector::class);
119135
};

src/Template/.github/workflows/rector.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ jobs:
6262
6363
- name: Analyze for refactoring
6464
run: |
65-
composer global require --dev rector/rector:^0.14
65+
composer global require --dev rector/rector:^0.15.1
6666
rector process --dry-run --no-progress-bar

src/Template/rector.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
4+
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
45
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
56
use Rector\CodeQuality\Rector\For_\ForToForeachRector;
67
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
@@ -29,16 +30,23 @@
2930
use Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector;
3031
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
3132
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
32-
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
3333
use Rector\PHPUnit\Set\PHPUnitSetList;
34+
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
3435
use Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector;
3536
use Rector\Set\ValueObject\LevelSetList;
3637
use Rector\Set\ValueObject\SetList;
3738
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
3839

3940
return static function (RectorConfig $rectorConfig): void {
40-
$rectorConfig->sets([SetList::DEAD_CODE, LevelSetList::UP_TO_PHP_74, PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, PHPUnitLevelSetList::UP_TO_PHPUNIT_100]);
41+
$rectorConfig->sets([
42+
SetList::DEAD_CODE,
43+
LevelSetList::UP_TO_PHP_74,
44+
PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD,
45+
PHPUnitSetList::PHPUNIT_100,
46+
]);
47+
4148
$rectorConfig->parallel();
49+
4250
// The paths to refactor (can also be supplied with CLI arguments)
4351
$rectorConfig->paths([
4452
__DIR__ . '/app/',
@@ -80,7 +88,7 @@
8088
__DIR__ . '/tests',
8189
],
8290

83-
// Ignore files that should not be namespaced
91+
// Ignore files that should not be namespaced to their folder
8492
NormalizeNamespaceByPSR4ComposerAutoloadRector::class => [
8593
__DIR__ . '/app/Helpers',
8694
],
@@ -91,6 +99,10 @@
9199
// May be uninitialized on purpose
92100
AddDefaultValueForUndefinedVariableRector::class,
93101
]);
102+
103+
// auto import fully qualified class names
104+
$rectorConfig->importNames();
105+
94106
$rectorConfig->rule(SimplifyUselessVariableRector::class);
95107
$rectorConfig->rule(RemoveAlwaysElseRector::class);
96108
$rectorConfig->rule(CountArrayToEmptyArrayComparisonRector::class);
@@ -118,4 +130,7 @@
118130
// Set to false if you use in libraries, or it does create breaking changes.
119131
TypedPropertyFromAssignsRector::INLINE_PUBLIC => true,
120132
]);
133+
$rectorConfig->rule(StringClassNameToClassConstantRector::class);
134+
$rectorConfig->rule(PrivatizeFinalClassPropertyRector::class);
135+
$rectorConfig->rule(CompleteDynamicPropertiesRector::class);
121136
};

0 commit comments

Comments
 (0)