mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Replace requirement for package-versions with Composer 2 APIs
This commit is contained in:
parent
3a0adabf06
commit
7f26a5b473
@ -25,7 +25,7 @@
|
||||
"ext-tokenizer": "*",
|
||||
"amphp/amp": "^2.4.2",
|
||||
"amphp/byte-stream": "^1.5",
|
||||
"composer/package-versions-deprecated": "^1.10.0",
|
||||
"composer-runtime-api": "^2",
|
||||
"composer/semver": "^1.4 || ^2.0 || ^3.0",
|
||||
"composer/xdebug-handler": "^2.0 || ^3.0",
|
||||
"dnoegel/php-xdg-base-dir": "^0.1.1",
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Psalm\Internal;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use OutOfBoundsException;
|
||||
use PackageVersions\Versions;
|
||||
use Phar;
|
||||
@ -89,11 +90,17 @@ final class VersionUtils
|
||||
{
|
||||
try {
|
||||
return [
|
||||
self::PSALM_PACKAGE => Versions::getVersion(self::PSALM_PACKAGE),
|
||||
self::PHP_PARSER_PACKAGE => Versions::getVersion(self::PHP_PARSER_PACKAGE),
|
||||
self::PSALM_PACKAGE => self::getVersion(self::PSALM_PACKAGE),
|
||||
self::PHP_PARSER_PACKAGE => self::getVersion(self::PHP_PARSER_PACKAGE),
|
||||
];
|
||||
} catch (OutOfBoundsException $ex) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static function getVersion(string $packageName): string
|
||||
{
|
||||
return InstalledVersions::getPrettyVersion($packageName)
|
||||
. '@' . InstalledVersions::getReference($packageName);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user