-
Notifications
You must be signed in to change notification settings - Fork 696
Closed
Labels
Help wantedeasy problemsIssues that can be fixed without background knowledge of PsalmIssues that can be fixed without background knowledge of Psalmenhancement
Description
Steps to reproduce
- Set
phpVersionto"5.1"in the configuration file. - Run Psalm.
Actual result
Uncaught UnexpectedValueException: Expecting a version number in the format x.y in /opt/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php:1174
Stack trace:
#0 /opt/psalm/vendor/vimeo/psalm/src/Psalm/Internal/CliUtils.php(500): Psalm\Internal\Analyzer\ProjectAnalyzer->setPhpVersion('5.1', 'config')
#1 /opt/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Cli/Psalm.php(349): Psalm\Internal\CliUtils::initPhpVersion(Array, Object(Psalm\Config), Object(Psalm\Internal\Analyzer\ProjectAnalyzer))
#2 /opt/psalm/vendor/vimeo/psalm/psalm(9): Psalm\Internal\Cli\Psalm::run(Array)
#3 /opt/psalm/vendor/bin/psalm(119): include('/opt/psalm/vend...')
#4 {main}
(Psalm 5.11.0@c9b192ab8400fdaf04b2b13d110575adc879aa90 crashed due to an uncaught Throwable)
Expected result
- No uncaught exception, no stack trace.
- Correct error message telling that PHP 5.1 specified in the configuration file ".xml" is not supported by Psalm, and only PHP 5.4-5.6, 7.0-7.4, 8.0-8.2 are supported.
Root cause
psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php
Lines 1182 to 1184 in dc81630
| if (!preg_match('/^(5\.[456]|7\.[01234]|8\.[012])(\..*)?$/', $version)) { | |
| throw new UnexpectedValueException('Expecting a version number in the format x.y'); | |
| } |
Additional information
The error message is also wrong because actually version numbers in the formats x.y.z (e.g. "8.2.8") are also expected.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Help wantedeasy problemsIssues that can be fixed without background knowledge of PsalmIssues that can be fixed without background knowledge of Psalmenhancement