code: public function findRecommendedRequireVersion(PackageInterface $package)
      {
          $version = $package->getVersion();
          if (!$package->isDev()) {
              return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
          }
  
          $loader = new ArrayLoader($this->getParser());
          $dumper = new ArrayDumper();
          $extra = $loader->getBranchAlias($dumper->dump($package));
          if ($extra) {
              $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
              if ($count) {
                  $extra = str_replace('.9999999', '.0', $extra);
  
                  return $this->transformVersion($extra, $extra, 'dev');
              }
          }
  
          return $package->getPrettyVersion();
      }
docs: Given a concrete version, this returns a ~ constraint (when possible)
  that should be used, for example, in composer.json.
  
  For example:
  * 1.2.1         -> ^1.2
  * 1.2           -> ^1.2
  * v3.2.1        -> ^3.2
  * 2.0-beta.1    -> ^2.0@beta
  * dev-master    -> ^2.1@dev      (dev version with alias)
  * dev-master    -> dev-master    (dev versions are untouched)
  
  @param  PackageInterface $package
  @return string