diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index 40ff8907c..171cf0362 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -258,7 +258,10 @@ class Locker $lock['packages-dev'] = $this->lockPackages($devPackages); } - if (empty($lock['packages']) && empty($lock['packages-dev'])) { + $lock['platform'] = $platformReqs; + $lock['platform-dev'] = $platformDevReqs; + + if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) { if ($this->lockFile->exists()) { unlink($this->lockFile->getPath()); } @@ -266,9 +269,6 @@ class Locker return false; } - $lock['platform'] = $platformReqs; - $lock['platform-dev'] = $platformDevReqs; - if (!$this->isLocked() || $lock !== $this->getLockData()) { $this->lockFile->write($lock); $this->lockDataCache = null;