Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer PHP version detected incorrectly #5415

Closed
AndrolGenhald opened this issue Mar 17, 2021 · 1 comment
Closed

Composer PHP version detected incorrectly #5415

AndrolGenhald opened this issue Mar 17, 2021 · 1 comment

Comments

@AndrolGenhald
Copy link
Collaborator

AndrolGenhald commented Mar 17, 2021

I have a project requiring "php": "^7.2.5". It looks like Psalm only cares about semver major and minor versions, but the way it detects it is by finding the lowest MAJOR.MINOR version that satisfies the composer required version. Since this project requires 7.2.5, 7.2 does not satisfy that, but 7.3 does, so it returns 7.3. I would expect it to detect 7.2.

psalm/src/Psalm/Config.php

Lines 2056 to 2060 in 3046468

foreach (['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] as $candidate) {
if (Semver::satisfies($candidate, $php_version)) {
return $candidate;
}
}

@orklah
Copy link
Collaborator

orklah commented Mar 17, 2021

It would also not return anything for a project that pinned it's PHP version to "7.2.5" because it doesn't satisfy 7.2 nor 7.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants