code: public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
      {
          if (!$repo->hasPackage($initial)) {
              throw new \InvalidArgumentException('Package is not installed: '.$initial);
          }
  
          $repo->removePackage($initial);
          if (!$repo->hasPackage($target)) {
              $repo->addPackage(clone $target);
          }
      }
docs: {@inheritDoc}