diff --git a/src/Composer/Plugin.php b/src/Composer/Plugin.php index 32ef401..ee0dbf4 100644 --- a/src/Composer/Plugin.php +++ b/src/Composer/Plugin.php @@ -452,12 +452,21 @@ private function updateComposerJson(array $missingRequires, bool $sortPackages) private function updateComposerLock(Composer $composer, IOInterface $io) { + if ($composer->getConfig()->get('lock') === false) { + return; + } + $lock = substr(Factory::getComposerFile(), 0, -4).'lock'; $composerJson = file_get_contents(Factory::getComposerFile()); $lockFile = new JsonFile($lock, null, $io); $locker = ClassDiscovery::safeClassExists(RepositorySet::class) ? new Locker($io, $lockFile, $composer->getInstallationManager(), $composerJson) : new Locker($io, $lockFile, $composer->getRepositoryManager(), $composer->getInstallationManager(), $composerJson); + + if (!$locker->isLocked()) { + return; + } + $lockData = $locker->getLockData(); $lockData['content-hash'] = Locker::getContentHash($composerJson); $lockFile->write($lockData);