diff --git a/src/Badoo/SoftMocks.php b/src/Badoo/SoftMocks.php index d99806e..06235e7 100644 --- a/src/Badoo/SoftMocks.php +++ b/src/Badoo/SoftMocks.php @@ -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; }