diff --git a/src/Tools/GetVersions.php b/src/Tools/GetVersions.php index 429f011f..a37bace2 100644 --- a/src/Tools/GetVersions.php +++ b/src/Tools/GetVersions.php @@ -40,7 +40,11 @@ private function findComposerPackages() return []; } - $installedTools = json_decode((string) file_get_contents($installedJson)); + $parsedInstalledJson = json_decode((string) file_get_contents($installedJson)); + + // Has a "packages" key in Composer 2 + $installedTools = $parsedInstalledJson->packages ? $parsedInstalledJson->packages : $parsedInstalledJson; + if (!is_array($installedTools)) { return []; }