mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Allow older composer/semver cc @xurizaemon
This commit is contained in:
parent
ec7de89f0c
commit
2d197e3e12
@ -24,7 +24,7 @@
|
||||
"amphp/amp": "^2.4.2",
|
||||
"amphp/byte-stream": "^1.5",
|
||||
"composer/package-versions-deprecated": "^1.8.0",
|
||||
"composer/semver": "^2.0 || ^3.0",
|
||||
"composer/semver": "^1.4 || ^2.0 || ^3.0",
|
||||
"composer/xdebug-handler": "^1.1",
|
||||
"dnoegel/php-xdg-base-dir": "^0.1.1",
|
||||
"felixfbecker/advanced-json-rpc": "^3.0.3",
|
||||
|
@ -2064,14 +2064,17 @@ class Config
|
||||
|
||||
if (\is_string($php_version)) {
|
||||
$version_parser = new VersionParser();
|
||||
$min_php_version = $version_parser->parseConstraints($php_version)->getLowerBound()->getVersion();
|
||||
|
||||
$constraint = $version_parser->parseConstraints($php_version);
|
||||
|
||||
foreach (['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] as $candidate) {
|
||||
if (Semver::satisfies($min_php_version, "~$candidate.0")) {
|
||||
if ($constraint->matches(new \Composer\Semver\Constraint\Constraint('<=', "$candidate.0.0-dev"))) {
|
||||
return $candidate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user