From 7c0fdfe8fbe97bbc0f506a45a81b543b49ed11c3 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Mon, 20 Jan 2020 14:24:04 +0100 Subject: [PATCH] Compatibility with Composer v2 installed.json file format --- .../ComposerJsonAndInstalledJsonSourceLocatorMaker.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php b/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php index 3cb7a7410c..4d668dc3ae 100644 --- a/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php +++ b/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php @@ -52,7 +52,8 @@ public function create(string $installationPath): ?SourceLocator $composer = Json::decode($composerJsonContents, Json::FORCE_ARRAY); $installedJsonContents = FileReader::read($installedJsonPath); - $installed = Json::decode($installedJsonContents, Json::FORCE_ARRAY); + $installedJson = Json::decode($installedJsonContents, Json::FORCE_ARRAY); + $installed = $installedJson['packages'] ?? $installedJson; $classMapPaths = array_merge( $this->prefixPaths($this->packageToClassMapPaths($composer), $installationPath . '/'),