Skip to content

Commit 2658641

Browse files
committed
allow overriding the minimum PHP release for rector
By setting the environment variable RECTOR_MIN_PHP the supported minimum PHP release can be set. This is needed to make plugin changes compatible with DokuWiki stable.
1 parent e6a8264 commit 2658641

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

_test/rector.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,14 @@
6262
$rectorConfig->cacheClass(FileCacheStorage::class);
6363
$rectorConfig->cacheDirectory(__DIR__ . '/.rector-cache');
6464

65+
// supported minimum PHP version can be overridden by environment variable
66+
[$major, $minor] = explode('.', $_SERVER['RECTOR_MIN_PHP'] ?? '7.4');
67+
$phpset = LevelSetList::class . '::UP_TO_PHP_' . $major . $minor;
68+
echo "Using PHP set $phpset\n";
69+
6570
// define sets of rules
6671
$rectorConfig->sets([
67-
LevelSetList::UP_TO_PHP_74,
72+
constant($phpset),
6873
SetList::CODE_QUALITY,
6974
SetList::DEAD_CODE,
7075
SetList::CODING_STYLE,

0 commit comments

Comments
 (0)