Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/Badoo/SoftMocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -710,10 +710,12 @@ protected static function initParserVersion()
"Can't parse installed packages json for get nikic/php-parser version for for right rewritten files cache: {$error}"
);
}
// in composer 2 packages are stored in 'packages' key.
// composer-runtime-api could be used for this check, but it is available for composer 2 only
$packages = $installed['packages'] ?? $installed;
foreach ($packages as $package) {

// If the installed.json is the latest version then update the installed variable
if (array_key_exists('packages', $installed)) {
$installed = $installed['packages'];
}
foreach ($installed as $package) {
if (!isset($package['name'], $package['version'])) {
continue;
}
Expand Down