Created
January 12, 2026 09:57
-
-
Save mateuszfl/0323210e302977c6e674684a6116a30c to your computer and use it in GitHub Desktop.
rector-compat-gate-84.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| use Rector\Config\RectorConfig; | |
| use Rector\Set\ValueObject\LevelSetList; | |
| return static function (RectorConfig $rectorConfig): void { | |
| $paths = array_values(array_filter([ | |
| is_dir('src') ? 'src' : null, | |
| is_dir('tests') ? 'tests' : null, | |
| ])); | |
| $rectorConfig->paths($paths); | |
| $set = getenv('RECTOR_COMPAT_SET') ?: 'UP_TO_PHP_82'; | |
| $map = [ | |
| 'UP_TO_PHP_81' => LevelSetList::UP_TO_PHP_81, | |
| 'UP_TO_PHP_82' => LevelSetList::UP_TO_PHP_82, | |
| 'UP_TO_PHP_83' => LevelSetList::UP_TO_PHP_83, | |
| 'UP_TO_PHP_84' => LevelSetList::UP_TO_PHP_84, | |
| ]; | |
| if (!isset($map[$set])) { | |
| throw new RuntimeException(sprintf('Unknown rector compat set: %s', $set)); | |
| } | |
| $rectorConfig->sets([$map[$set]]); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment