1
0
Fork 0

Merge branch '2.0'

pull/9817/head
Jordi Boggiano 2021-04-07 13:24:47 +02:00
commit cb2db16637
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 6 additions and 3 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
@ -200,7 +202,7 @@ class InstalledVersions
* Returns the raw installed.php data for custom implementations * Returns the raw installed.php data for custom implementations
* *
* @return array[] * @return array[]
* @psalm-return 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[]}>} * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[]}, versions: array<string, array{pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[]}>}
*/ */
public static function getRawData() public static function getRawData()
{ {
@ -223,7 +225,7 @@ class InstalledVersions
* @param array[] $data A vendor/composer/installed.php data set * @param array[] $data A vendor/composer/installed.php data set
* @return void * @return void
* *
* @psalm-param 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[]}>} $data * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[]}, versions: array<string, array{pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[]}>} $data
*/ */
public static function reload($data) public static function reload($data)
{ {
@ -233,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: array<string, array{pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[]}>}>
*/ */
private static function getInstalled() private static function getInstalled()
{ {