Skip to content

Commit

Permalink
Merge branch 'main' into carbon-settestnow-to-travelto-rector
Browse files Browse the repository at this point in the history
  • Loading branch information
GeniJaho authored Aug 11, 2024
2 parents c920fed + 1d57d99 commit f5245b2
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,43 @@ Install as a dev dependency:
composer require --dev driftingly/rector-laravel
```

## Use Sets
## Automate Laravel Upgrades

To add a set to your config, use `RectorLaravel\Set\LaravelSetList` class and pick one of the constants:
To add a set to your config, use `RectorLaravel\Set\LaravelLevelSetList` and pick the constant that matches your target version.
Sets for higher versions include sets for lower versions.

```php
<?php
<?php declare(strict_types=1);

declare(strict_types=1);
use Rector\Config\RectorConfig;
use RectorLaravel\Set\LaravelLevelSetList;

return RectorConfig::configure()
->withSets([
LaravelLevelSetList::UP_TO_LARAVEL_110,
]);
```

The sets in `RectorLaravel\Set\LaravelSetList` only contain changes related to a specific version upgrade.
For example, the rules in `LaravelSetList::LARAVEL_110` apply when upgrading from Laravel 10 to Laravel 11.

## Additional Sets

To improve different aspects of your code, use the sets in `RectorLaravel\Set\LaravelSetList`.

```php
<?php declare(strict_types=1);

use Rector\Config\RectorConfig;
use RectorLaravel\Set\LaravelSetList;

return RectorConfig::configure()
->withSets([
LaravelSetList::LARAVEL_110
LaravelSetList::LARAVEL_CODE_QUALITY,
LaravelSetList::LARAVEL_COLLECTION,
...
]);
```
## Available Sets

| Set | Purpose |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
Expand Down

0 comments on commit f5245b2

Please sign in to comment.