From 7ae3fbb81d2eb4a42f9594df134b1ab8ad7944de Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 7 Apr 2021 13:22:48 +0200 Subject: [PATCH 1/2] Fix doctype annotations --- src/Composer/InstalledVersions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Composer/InstalledVersions.php b/src/Composer/InstalledVersions.php index ecf517ad8..0747be367 100644 --- a/src/Composer/InstalledVersions.php +++ b/src/Composer/InstalledVersions.php @@ -202,7 +202,7 @@ class InstalledVersions * Returns the raw installed.php data for custom implementations * * @return array[] - * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[]}, versions: list} + * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[]}, versions: array} */ public static function getRawData() { @@ -225,7 +225,7 @@ class InstalledVersions * @param array[] $data A vendor/composer/installed.php data set * @return void * - * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[]}, versions: list} $data + * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[]}, versions: array} $data */ public static function reload($data) { @@ -235,7 +235,7 @@ class InstalledVersions /** * @return array[] - * @psalm-return list}> + * @psalm-return list}> */ private static function getInstalled() { From f5e6cc89cd8d45c99cff77ee80d0f324ada45686 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 7 Apr 2021 12:46:09 +0200 Subject: [PATCH 2/2] Deprecate InstalledVersions::getRawData in favor of getAllRawData --- src/Composer/InstalledVersions.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Composer/InstalledVersions.php b/src/Composer/InstalledVersions.php index 0747be367..7789617a0 100644 --- a/src/Composer/InstalledVersions.php +++ b/src/Composer/InstalledVersions.php @@ -201,14 +201,28 @@ class InstalledVersions /** * Returns the raw installed.php data for custom implementations * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. * @return array[] * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[]}, versions: array} */ public static function getRawData() { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + return self::$installed; } + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + /** * Lets you reload the static array from another file *