Phpro\SoapClient\Util\Filesystem::removeBackup PHP Method

removeBackup() public method

public removeBackup ( string $file )
$file string
    public function removeBackup($file)
    {
        $backupFile = preg_replace('{\\.backup$}', '', $file) . '.backup';
        if (!$this->fileExists($backupFile)) {
            return;
        }
        unlink($backupFile);
    }

Usage Example

 /**
  * This method tries to patch an existing type class.
  *
  * @param TypeGenerator   $generator
  * @param Type            $type
  * @param string          $path
  *
  * @return bool
  */
 protected function patchExistingFile(TypeGenerator $generator, Type $type, $path)
 {
     try {
         $this->filesystem->createBackup($path);
         $file = FileGenerator::fromReflectedFileName($path);
         $this->generateType($file, $generator, $type, $path);
     } catch (\Exception $e) {
         $this->output->writeln('<fg=red>' . $e->getMessage() . '</fg=red>');
         $this->filesystem->removeBackup($path);
         return false;
     }
     return true;
 }