Skip to content

Instantly share code, notes, and snippets.

@mateuszfl
Created January 12, 2026 09:57
Show Gist options
  • Select an option

  • Save mateuszfl/0323210e302977c6e674684a6116a30c to your computer and use it in GitHub Desktop.

Select an option

Save mateuszfl/0323210e302977c6e674684a6116a30c to your computer and use it in GitHub Desktop.
rector-compat-gate-84.php
<?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