Skip to content

Commit 0f2b163

Browse files
committed
minor #662 Update Unpacker.php (Gemorroj)
This PR was squashed before being merged into the 1.8-dev branch. Discussion ---------- Update Unpacker.php read the json file once Commits ------- 8019d06 Update Unpacker.php
2 parents 5fedaf8 + 8019d06 commit 0f2b163

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Unpacker.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ public function updateLock(Result $result, IOInterface $io): void
133133
}
134134
}
135135
}
136+
$jsonContent = file_get_contents($json->getPath());
136137
$lockData['packages'] = array_values($lockData['packages']);
137138
$lockData['packages-dev'] = array_values($lockData['packages-dev']);
138-
$lockData['content-hash'] = $locker->getContentHash(file_get_contents($json->getPath()));
139+
$lockData['content-hash'] = $locker->getContentHash($jsonContent);
139140
$lockFile = new JsonFile(substr($json->getPath(), 0, -4).'lock', null, $io);
140141

141142
if (!$this->dryRun) {
@@ -144,9 +145,9 @@ public function updateLock(Result $result, IOInterface $io): void
144145

145146
// force removal of files under vendor/
146147
if (version_compare('2.0.0', PluginInterface::PLUGIN_API_VERSION, '>')) {
147-
$locker = new Locker($io, $lockFile, $this->composer->getRepositoryManager(), $this->composer->getInstallationManager(), file_get_contents($json->getPath()));
148+
$locker = new Locker($io, $lockFile, $this->composer->getRepositoryManager(), $this->composer->getInstallationManager(), $jsonContent);
148149
} else {
149-
$locker = new Locker($io, $lockFile, $this->composer->getInstallationManager(), file_get_contents($json->getPath()));
150+
$locker = new Locker($io, $lockFile, $this->composer->getInstallationManager(), $jsonContent);
150151
}
151152
$this->composer->setLocker($locker);
152153
}

0 commit comments

Comments
 (0)