Skip to content

Commit

Permalink
Check upper bound too
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Mar 29, 2021
1 parent 2d197e3 commit d4377c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Psalm/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2068,7 +2068,9 @@ private function getPHPVersionFromComposerJson(): ?string
$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 ($constraint->matches(new \Composer\Semver\Constraint\Constraint('<=', "$candidate.0.0-dev"))) {
if ($constraint->matches(new \Composer\Semver\Constraint\Constraint('<=', "$candidate.0.0-dev"))
|| $constraint->matches(new \Composer\Semver\Constraint\Constraint('<=', "$candidate.999"))
) {
return $candidate;
}
}
Expand Down

0 comments on commit d4377c0

Please sign in to comment.