Skip to main content

Module root_version

Module root_version 

Source
Expand description

Root package version: port of RootPackageLoader::load + VersionGuesser::guessGitVersion (docs/reference/RootPackageLoader.php, VersionGuesser.php, Composer 2.10.3). Order: version from composer.json, else COMPOSER_ROOT_VERSION, else git (current branch; detached HEAD -> dev-<sha> then exact tag; feature branch -> closest parent branch by git rev-list), else 1.0.0+no-version-set. hg/fossil/svn are not ported (fallback to the default, as without a VCS).

Structs§

RootVersion
UnsupportedVersionAlias

Constants§

DEFAULT_BRANCH_ALIAS
VersionParser::DEFAULT_BRANCH_ALIAS.
DEFAULT_PRETTY_VERSION

Functions§

branch_alias
Branch alias of the root: getBranchAlias on the composer.json, the version being the pretty version retained by RootPackageLoader.
branch_alias_of
ArrayLoader::getBranchAlias (Composer 2.10.3): the alias Composer attaches to a package (root or locked) whose version is a branch (dev-* or *-dev). extra.branch-alias takes priority (-dev target, normalised by normalizeBranch, source equal to the version ignoring case, compatible numeric prefix), else 9999999-dev if default-branch is true and the version has no numeric prefix. Returns (normalised alias, pretty alias); the pretty one is installed.php’s.
detect
Determines the root version like RootPackageLoader.
normalize_branch
VersionParser::normalizeBranch (composer/semver): 1.2 -> numeric 1.2.x.x-dev (x -> 9999999), else dev-<name>.
parse_numeric_alias_prefix
VersionParser::parseNumericAliasPrefix (composer/semver): 1.2.x-dev and 1.2-dev -> 1.2., else None. Case-insensitive like the PCRE pattern.