Skip to content

Commit 6dcfe46

Browse files
authored
Update Rector to 1.0 (#176)
* Update Rector to `1.0` * Update Rector config * Update readme
1 parent 4d9188b commit 6dcfe46

File tree

4 files changed

+25
-26
lines changed

4 files changed

+25
-26
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@ composer require driftingly/rector-laravel --dev
1717
To add a set to your config, use `RectorLaravel\Set\LaravelSetList` class and pick one of the constants:
1818

1919
```php
20-
use RectorLaravel\Set\LaravelSetList;
20+
<?php
21+
22+
declare(strict_types=1);
23+
2124
use Rector\Config\RectorConfig;
25+
use RectorLaravel\Set\LaravelSetList;
2226

23-
return static function (RectorConfig $rectorConfig): void {
24-
$rectorConfig->sets([
27+
return RectorConfig::configure()
28+
->withSets([
2529
LaravelSetList::LARAVEL_110
2630
]);
27-
};
2831
```
2932

30-
<br>
31-
3233
## Learn Rector Faster
3334

3435
Rector is a tool that [we develop](https://getrector.org/) and share for free, so anyone can save hundreds of hours on refactoring.

build/composer-php-72.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description": "Rector upgrades rules for Laravel Framework",
66
"require": {
77
"php": "^7.2 || ^8.0",
8-
"rector/rector": "^0.19.0"
8+
"rector/rector": "^1.0"
99
},
1010
"autoload": {
1111
"psr-4": {

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
"description": "Rector upgrades rules for Laravel Framework",
66
"require": {
77
"php": ">=8.2",
8-
"rector/rector": "^0.19.0"
8+
"rector/rector": "^1.0"
99
},
1010
"require-dev": {
11-
"phpunit/phpunit": "^10.0",
12-
"phpstan/phpstan": "^1.8.2",
11+
"phpunit/phpunit": "^10.5",
12+
"phpstan/phpstan": "^1.10",
1313
"symplify/phpstan-rules": "^12.4",
14-
"symplify/phpstan-extensions": "^11.0",
14+
"symplify/phpstan-extensions": "^11.4",
1515
"symplify/rule-doc-generator": "^12.1",
16-
"phpstan/extension-installer": "^1.1",
17-
"phpstan/phpstan-webmozart-assert": "^1.1",
18-
"phpstan/phpstan-strict-rules": "^1.2",
16+
"phpstan/extension-installer": "^1.3",
17+
"phpstan/phpstan-webmozart-assert": "^1.2",
18+
"phpstan/phpstan-strict-rules": "^1.5",
1919
"tightenco/duster": "^2.7"
2020
},
2121
"autoload": {

rector.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,21 @@
44

55
use Rector\Config\RectorConfig;
66
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
7-
use Rector\Set\ValueObject\LevelSetList;
8-
use Rector\Set\ValueObject\SetList;
97

10-
return static function (RectorConfig $rectorConfig): void {
11-
$rectorConfig->importNames();
12-
13-
$rectorConfig->paths([__DIR__ . '/src', __DIR__ . '/tests']);
14-
15-
$rectorConfig->skip([
8+
return RectorConfig::configure()
9+
->withImportNames()
10+
->withPaths([
11+
__DIR__ . '/src',
12+
__DIR__ . '/tests',
13+
])
14+
->withSkip([
1615
// for tests
1716
'*/Source/*',
1817
'*/Fixture/*',
1918

2019
// skip for handle scoped, like in the rector-src as well
2120
// @see https://github.com/rectorphp/rector-src/blob/7f73cf017214257c170d34db3af7283eaeeab657/rector.php#L71
2221
StringClassNameToClassConstantRector::class,
23-
]);
24-
25-
$rectorConfig->sets([LevelSetList::UP_TO_PHP_82, SetList::DEAD_CODE, SetList::CODE_QUALITY, SetList::NAMING]);
26-
};
22+
])
23+
->withPhpSets()
24+
->withPreparedSets(deadCode: true, codeQuality: true, naming: true);

0 commit comments

Comments
 (0)