Skip to content

Commit a134f6a

Browse files
Allow using a canonical dist file (#7845)
1 parent 5ce62c7 commit a134f6a

File tree

16 files changed

+187
-35
lines changed

16 files changed

+187
-35
lines changed

.github/workflows/e2e.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
- 'e2e/applied-rule-change-docblock'
3030
- 'e2e/applied-rule-removed-node'
3131
- 'e2e/applied-rule-return-array-nodes'
32+
- 'e2e/config-dist-fallback'
33+
- 'e2e/config-file-priority'
3234
- 'e2e/different-path-over-skip-config'
3335
- 'e2e/invalid-paths'
3436
- 'e2e/no-parallel-reflection-resolver'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"require": {
3+
"php": "^8.1"
4+
},
5+
"minimum-stability": "dev",
6+
"prefer-stable": true
7+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1 file with changes
2+
===================
3+
4+
1) src/SomeClass.php:4
5+
6+
---------- begin diff ----------
7+
@@ @@
8+
9+
final class SomeClass
10+
{
11+
- /**
12+
- * @var string
13+
- */
14+
public string $name = 'name';
15+
}
16+
----------- end diff -----------
17+
18+
Applied rules:
19+
* RemoveUselessVarTagRector
20+
21+
22+
[OK] 1 file would have been changed (dry-run) by Rector
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->paths([
10+
__DIR__ . '/src',
11+
]);
12+
13+
// This rule should be applied when rector.dist.php is used as fallback
14+
$rectorConfig->rule(RemoveUselessVarTagRector::class);
15+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
final class SomeClass
6+
{
7+
/**
8+
* @var string
9+
*/
10+
public string $name = 'name';
11+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"require": {
3+
"php": "^8.1"
4+
},
5+
"minimum-stability": "dev",
6+
"prefer-stable": true
7+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1 file with changes
2+
===================
3+
4+
1) src/SomeClass.php:4
5+
6+
---------- begin diff ----------
7+
@@ @@
8+
9+
final class SomeClass
10+
{
11+
- /**
12+
- * @var string
13+
- */
14+
public string $name = 'name';
15+
}
16+
----------- end diff -----------
17+
18+
Applied rules:
19+
* RemoveUselessVarTagRector
20+
21+
22+
[OK] 1 file would have been changed (dry-run) by Rector
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->paths([
10+
__DIR__ . '/src',
11+
]);
12+
13+
// This rule should NOT be applied because rector.php takes priority
14+
$rectorConfig->rule(ClosureToArrowFunctionRector::class);
15+
};

0 commit comments

Comments
 (0)