Skip to main content

Module constraint

Module constraint 

Source
Expand description

Subset of composer/semver constraints for the platform check. Port of VersionParser::parseConstraint(s) (pinned source: docs/reference/SemverVersionParser.php, extracted from the 2.10.3 phar).

Key rules reproduced:

  • * / x.*: interval [X...-dev, X+1...-dev), a bare * matches everything;
  • ^X.Y.Z / ~X.Y.Z: lower bound >= version-dev (when there is no explicit stability suffix), exclusive upper bound < next-dev;
  • >=V and <V without suffix: the bound becomes V-dev (>=8.1 accepts 8.1.0-beta1, <2.0 rejects 2.0.0-beta); >V and <=V keep the version as is;
  • A - B: >= A-dev; <= B if B has a patch/suffix, else < next(B)-dev;
  • OR on || or |, AND on commas/spaces.

Outside the subset (dev-* branches, as aliases, @stability…): Unsupported, the caller treats the case as out of scope.

Structs§

Constraint
OR groups of conjunctions of simple constraints.
LowerBound
Lower bound of a constraint (composer/semver’s Bound): the smallest admitted version and its inclusivity. None = zero bound (* constraint, or an OR branch without a lower bound).
UnsupportedConstraint

Functions§

satisfies
Shortcut: does version satisfy constraint?