code: private function moveUninstallsToFront(array $operations)
      {
          $uninstOps = array();
          foreach ($operations as $idx => $op) {
              if ($op instanceof UninstallOperation) {
                  $uninstOps[] = $op;
                  unset($operations[$idx]);
              }
          }
  
          return array_merge($uninstOps, $operations);
      }
docs: Removals of packages should be executed before installations in
  case two packages resolve to the same path (due to custom installers)
  
  @param  OperationInterface[] $operations
  @return OperationInterface[] reordered operation list