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).
guess_version is the VersionGuesser::guessVersion used for the root
and for the packages of a path repository: git is run in the directory
with no GIT_DIR pin, so it walks up to the enclosing repository exactly
as Composer’s git branch does (a package without a repository of its
own takes the project’s branch).
Structs§
- Guessed
Version VersionGuesser::guessVersionresult afterpostprocess: the version (the parent branch when HEAD is on a feature branch) and, on a feature branch, the feature branch itself (feature_version,feature_pretty_version) — apathrepository loads both as packages.- Root
Version - Unsupported
Version Alias
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-aliastakes priority (-devtarget, normalised by normalizeBranch, source equal to the version ignoring case, compatible numeric prefix), else9999999-devifdefault-branchis 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.
- git
- Runs git in
dirlikeProcessExecutorafterGitUtil::cleanEnv: noGIT_DIR/GIT_WORK_TREE(git finds the repository by walking up), English output, never an interactive prompt. None when git fails. - guess_
version VersionGuesser::guessVersion(git only) +postprocess.- normalize_
branch VersionParser::normalizeBranch(composer/semver):1.2-> numeric1.2.x.x-dev(x -> 9999999), elsedev-<name>.- parse_
numeric_ alias_ prefix VersionParser::parseNumericAliasPrefix(composer/semver):1.2.x-devand1.2-dev->1.2., else None. Case-insensitive like the PCRE pattern.- root_
version_ from_ env VersionGuesser::getRootVersionFromEnv:COMPOSER_ROOT_VERSIONwhen set and non-empty,1.2-devspelled1.2.x-dev.