From 52a452c88525d17db0b30c84fb65df5b4386b1b1 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 7 Apr 2021 12:44:23 +0200 Subject: [PATCH] Improve InstalledVersions docs slightly --- doc/07-runtime.md | 2 +- src/Composer/InstalledVersions.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/07-runtime.md b/doc/07-runtime.md index ab90a57b3..933897732 100644 --- a/doc/07-runtime.md +++ b/doc/07-runtime.md @@ -31,7 +31,7 @@ Note that this can not be used to check whether platform packages are installed. ### Knowing whether package X is installed in version Y -> **Note:** To use this, your package must require `"composer/semver": "^2.0"`. +> **Note:** To use this, your package must require `"composer/semver": "^3.0"`. ```php use Composer\Semver\VersionParser; diff --git a/src/Composer/InstalledVersions.php b/src/Composer/InstalledVersions.php index bd5647882..ecf517ad8 100644 --- a/src/Composer/InstalledVersions.php +++ b/src/Composer/InstalledVersions.php @@ -18,6 +18,8 @@ use Composer\Semver\VersionParser; /** * This class is copied in every Composer installed project and available to all * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * * To require it's presence, you can require `composer-runtime-api ^2.0` */ class InstalledVersions @@ -39,7 +41,6 @@ class InstalledVersions $packages[] = array_keys($installed['versions']); } - if (1 === \count($packages)) { return $packages[0]; } @@ -234,6 +235,7 @@ class InstalledVersions /** * @return array[] + * @psalm-return list}> */ private static function getInstalled() {