function RequireCommand::revertComposerFile
3 calls to RequireCommand::revertComposerFile()
- RequireCommand::doUpdate in vendor/
composer/ composer/ src/ Composer/ Command/ RequireCommand.php - RequireCommand::execute in vendor/
composer/ composer/ src/ Composer/ Command/ RequireCommand.php - RequireCommand::updateRequirementsAfterResolution in vendor/
composer/ composer/ src/ Composer/ Command/ RequireCommand.php
File
-
vendor/
composer/ composer/ src/ Composer/ Command/ RequireCommand.php, line 621
Class
- RequireCommand
- @author Jérémy Romey <jeremy@free-agent.fr> @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\CommandCode
private function revertComposerFile() : void {
$io = $this->getIO();
if ($this->newlyCreated) {
$io->writeError("\n" . '<error>Installation failed, deleting ' . $this->file . '.</error>');
unlink($this->json
->getPath());
if (file_exists($this->lock)) {
unlink($this->lock);
}
}
else {
$msg = ' to its ';
if ($this->lockBackup) {
$msg = ' and ' . $this->lock . ' to their ';
}
$io->writeError("\n" . '<error>Installation failed, reverting ' . $this->file . $msg . 'original content.</error>');
file_put_contents($this->json
->getPath(), $this->composerBackup);
if ($this->lockBackup) {
file_put_contents($this->lock, $this->lockBackup);
}
}
}