\Composer\Package\VersionVersionSelector

Selects the best possible version for a package

Summary

Methods
Properties
Constants
__construct()
findBestCandidate()
findRecommendedRequireVersion()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
transformVersion()
getParser()
$pool
$parser
N/A

Properties

$pool

$pool : 

Type

$parser

$parser : 

Type

Methods

findBestCandidate()

findBestCandidate(string  $packageName, string  $targetPackageVersion = null, string  $targetPhpVersion = null, string  $preferredStability = 'stable') : \Composer\Package\PackageInterface|boolean

Given a package name and optional version, returns the latest PackageInterface that matches.

Parameters

string $packageName
string $targetPackageVersion
string $targetPhpVersion
string $preferredStability

Returns

\Composer\Package\PackageInterface|boolean

findRecommendedRequireVersion()

findRecommendedRequireVersion(\Composer\Package\PackageInterface  $package) : string

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)

Parameters

\Composer\Package\PackageInterface $package

Returns

string

transformVersion()

transformVersion(  $version,   $prettyVersion,   $stability) 

Parameters

$version
$prettyVersion
$stability

getParser()

getParser()