diff --git a/config/set/level/up-to-php54.php b/config/set/level/up-to-php54.php index b5c2075dd3a..f0ea0ae3bd4 100644 --- a/config/set/level/up-to-php54.php +++ b/config/set/level/up-to-php54.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php54.php', LevelSetList::UP_TO_PHP_53]); + $rectorConfig->sets([__DIR__ . '/../php54.php', __DIR__ . '/up-to-php53.php']); }; diff --git a/config/set/level/up-to-php55.php b/config/set/level/up-to-php55.php index 058e38cc83c..405030572a9 100644 --- a/config/set/level/up-to-php55.php +++ b/config/set/level/up-to-php55.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php55.php', LevelSetList::UP_TO_PHP_54]); + $rectorConfig->sets([__DIR__ . '/../php55.php', __DIR__ . '/up-to-php54.php']); }; diff --git a/config/set/level/up-to-php56.php b/config/set/level/up-to-php56.php index 597932db175..37cf07d4366 100644 --- a/config/set/level/up-to-php56.php +++ b/config/set/level/up-to-php56.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php56.php', LevelSetList::UP_TO_PHP_55]); + $rectorConfig->sets([__DIR__ . '/../php56.php', __DIR__ . '/up-to-php55.php']); }; diff --git a/config/set/level/up-to-php70.php b/config/set/level/up-to-php70.php index 63180376cfd..0f9baa7bd65 100644 --- a/config/set/level/up-to-php70.php +++ b/config/set/level/up-to-php70.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php70.php', LevelSetList::UP_TO_PHP_56]); + $rectorConfig->sets([__DIR__ . '/../php70.php', __DIR__ . '/up-to-php56.php']); }; diff --git a/config/set/level/up-to-php71.php b/config/set/level/up-to-php71.php index 24450d5d010..46273f897d1 100644 --- a/config/set/level/up-to-php71.php +++ b/config/set/level/up-to-php71.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php71.php', LevelSetList::UP_TO_PHP_70]); + $rectorConfig->sets([__DIR__ . '/../php71.php', __DIR__ . '/up-to-php70.php']); }; diff --git a/config/set/level/up-to-php72.php b/config/set/level/up-to-php72.php index 5110d2e174d..4d0b95436c6 100644 --- a/config/set/level/up-to-php72.php +++ b/config/set/level/up-to-php72.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php72.php', LevelSetList::UP_TO_PHP_71]); + $rectorConfig->sets([__DIR__ . '/../php72.php', __DIR__ . '/up-to-php71.php']); }; diff --git a/config/set/level/up-to-php73.php b/config/set/level/up-to-php73.php index d8db748b849..f7740b27523 100644 --- a/config/set/level/up-to-php73.php +++ b/config/set/level/up-to-php73.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php73.php', LevelSetList::UP_TO_PHP_72]); + $rectorConfig->sets([__DIR__ . '/../php73.php', __DIR__ . '/up-to-php72.php']); }; diff --git a/config/set/level/up-to-php74.php b/config/set/level/up-to-php74.php index 7167a9a5217..fb9feb11ee9 100644 --- a/config/set/level/up-to-php74.php +++ b/config/set/level/up-to-php74.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php74.php', LevelSetList::UP_TO_PHP_73]); + $rectorConfig->sets([__DIR__ . '/../php74.php', __DIR__ . '/up-to-php73.php']); }; diff --git a/config/set/level/up-to-php80.php b/config/set/level/up-to-php80.php index 9e59c83fad3..0c146a9ad5e 100644 --- a/config/set/level/up-to-php80.php +++ b/config/set/level/up-to-php80.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php80.php', LevelSetList::UP_TO_PHP_74]); + $rectorConfig->sets([__DIR__ . '/../php80.php', __DIR__ . '/up-to-php74.php']); }; diff --git a/config/set/level/up-to-php81.php b/config/set/level/up-to-php81.php index 50b364b522d..7cc1e939235 100644 --- a/config/set/level/up-to-php81.php +++ b/config/set/level/up-to-php81.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php81.php', LevelSetList::UP_TO_PHP_80]); + $rectorConfig->sets([__DIR__ . '/../php81.php', __DIR__ . '/up-to-php80.php']); }; diff --git a/config/set/level/up-to-php82.php b/config/set/level/up-to-php82.php index dd781e06268..fc2b5245602 100644 --- a/config/set/level/up-to-php82.php +++ b/config/set/level/up-to-php82.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php82.php', LevelSetList::UP_TO_PHP_81]); + $rectorConfig->sets([__DIR__ . '/../php82.php', __DIR__ . '/up-to-php81.php']); }; diff --git a/config/set/level/up-to-php83.php b/config/set/level/up-to-php83.php index 0702dc9287a..53999ca4fb6 100644 --- a/config/set/level/up-to-php83.php +++ b/config/set/level/up-to-php83.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php83.php', LevelSetList::UP_TO_PHP_82]); + $rectorConfig->sets([__DIR__ . '/../php83.php', __DIR__ . '/up-to-php82.php']); }; diff --git a/config/set/level/up-to-php84.php b/config/set/level/up-to-php84.php index 96325425ae3..498eb4b282d 100644 --- a/config/set/level/up-to-php84.php +++ b/config/set/level/up-to-php84.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php84.php', LevelSetList::UP_TO_PHP_83]); + $rectorConfig->sets([__DIR__ . '/../php84.php', __DIR__ . '/up-to-php83.php']); }; diff --git a/config/set/level/up-to-php85.php b/config/set/level/up-to-php85.php index 9c46ed9bbda..f93473fa55c 100644 --- a/config/set/level/up-to-php85.php +++ b/config/set/level/up-to-php85.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php85.php', LevelSetList::UP_TO_PHP_84]); + $rectorConfig->sets([__DIR__ . '/../php85.php', __DIR__ . '/up-to-php84.php']); }; diff --git a/config/set/level/up-to-php86.php b/config/set/level/up-to-php86.php index b12566e0db8..4e3bb28fdc9 100644 --- a/config/set/level/up-to-php86.php +++ b/config/set/level/up-to-php86.php @@ -3,8 +3,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([__DIR__ . '/../php86.php', LevelSetList::UP_TO_PHP_85]); + $rectorConfig->sets([__DIR__ . '/../php86.php', __DIR__ . '/up-to-php85.php']); }; diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index 4c17f31c053..473a1215bac 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -45,9 +45,9 @@ final class RectorConfigBuilder private const int MAX_LEVEL_GAP = 10; /** - * Matches the deprecated per-version PHP set files, e.g. .../config/set/php82.php + * Matches the deprecated per-version PHP set files, e.g. .../config/set/php82.php or .../config/set/level/up-to-php82.php */ - private const string DEPRECATED_PHP_SET_REGEX = '#/config/set/php\d+\.php$#'; + private const string DEPRECATED_PHP_SET_REGEX = '#/config/set/(level/up-to-)?php\d+\.php$#'; /** * A level method and the set that contains the very same rules, diff --git a/src/Set/ValueObject/LevelSetList.php b/src/Set/ValueObject/LevelSetList.php index 32c78c978cc..7d00b6edd2d 100644 --- a/src/Set/ValueObject/LevelSetList.php +++ b/src/Set/ValueObject/LevelSetList.php @@ -6,6 +6,7 @@ /** * @api + * @deprecated Use withPhpSets() or withPhpLevel() instead */ final class LevelSetList { diff --git a/tests/Issues/RuleWithConfigurationAfterSet/config/configured_rule.php b/tests/Issues/RuleWithConfigurationAfterSet/config/configured_rule.php index caa5195fc87..f9bb83040e1 100644 --- a/tests/Issues/RuleWithConfigurationAfterSet/config/configured_rule.php +++ b/tests/Issues/RuleWithConfigurationAfterSet/config/configured_rule.php @@ -4,10 +4,12 @@ use Rector\Config\RectorConfig; use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; -use Rector\Set\ValueObject\LevelSetList; +use Rector\Set\ValueObject\SetList; +use Rector\ValueObject\PhpVersion; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->sets([LevelSetList::UP_TO_PHP_81]); + $rectorConfig->sets([SetList::PHP_VERSION_BASED_SET]); + $rectorConfig->phpVersion(PhpVersion::PHP_81); $rectorConfig->ruleWithConfiguration(StringClassNameToClassConstantRector::class, ['Doctrine\*']); };