1
0
Fork 0

Improve InstalledVersions docs slightly

pull/9818/head
Jordi Boggiano 2021-04-07 12:44:23 +02:00
parent c3ae317a71
commit 52a452c885
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 4 additions and 2 deletions

View File

@ -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 ### 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 ```php
use Composer\Semver\VersionParser; use Composer\Semver\VersionParser;

View File

@ -18,6 +18,8 @@ use Composer\Semver\VersionParser;
/** /**
* This class is copied in every Composer installed project and available to all * 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` * To require it's presence, you can require `composer-runtime-api ^2.0`
*/ */
class InstalledVersions class InstalledVersions
@ -39,7 +41,6 @@ class InstalledVersions
$packages[] = array_keys($installed['versions']); $packages[] = array_keys($installed['versions']);
} }
if (1 === \count($packages)) { if (1 === \count($packages)) {
return $packages[0]; return $packages[0];
} }
@ -234,6 +235,7 @@ class InstalledVersions
/** /**
* @return array[] * @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[]}, versions: list<string, array{pretty_version: ?string, version: ?string, aliases: ?string[], reference: ?string, replaced: ?string[], provided: ?string[]}>}>
*/ */
private static function getInstalled() private static function getInstalled()
{ {