From 1179e4b4814023f90ea9d4519bc9d99e34983ebe Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 7 Apr 2021 13:27:20 +0200 Subject: [PATCH] Change root.dev-requirement to root.dev in installed.php as the root is not required per se, and this simply tracks the dev mode at install time --- src/Composer/InstalledVersions.php | 8 ++++---- src/Composer/Repository/FilesystemRepository.php | 3 ++- tests/Composer/Test/Repository/Fixtures/installed.php | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Composer/InstalledVersions.php b/src/Composer/InstalledVersions.php index b272573d9..4cd59b3a2 100644 --- a/src/Composer/InstalledVersions.php +++ b/src/Composer/InstalledVersions.php @@ -189,7 +189,7 @@ class InstalledVersions /** * @return array - * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[]} + * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool} */ public static function getRootPackage() { @@ -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: array} + * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool}, 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: array} $data + * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool}, 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() { diff --git a/src/Composer/Repository/FilesystemRepository.php b/src/Composer/Repository/FilesystemRepository.php index 42f119ee6..fefc52dfe 100644 --- a/src/Composer/Repository/FilesystemRepository.php +++ b/src/Composer/Repository/FilesystemRepository.php @@ -179,8 +179,9 @@ class FilesystemRepository extends WritableArrayRepository ); if ($package instanceof RootPackageInterface) { $versions['root'] = $versions['versions'][$package->getName()]; + unset($versions['root']['dev-requirement']); $versions['root']['name'] = $package->getName(); - $versions['root']['dev-requirement'] = $devMode; + $versions['root']['dev'] = $devMode; } } diff --git a/tests/Composer/Test/Repository/Fixtures/installed.php b/tests/Composer/Test/Repository/Fixtures/installed.php index fb17f8d69..8c6c148ae 100644 --- a/tests/Composer/Test/Repository/Fixtures/installed.php +++ b/tests/Composer/Test/Repository/Fixtures/installed.php @@ -18,8 +18,8 @@ return array( '1.10.x-dev', ), 'reference' => 'sourceref-by-default', - 'dev-requirement' => true, 'name' => '__root__', + 'dev' => true, ), 'versions' => array( '__root__' => array(