DO NOT IMPLEMENT this interface. It is only meant for usage as a type hint
in libraries relying on composer/semver but creating your own constraint class
that implements this interface is not a supported use case and will cause the
composer/semver components to return unexpected results.

Abstract Interface
public abstract __toString () : string
  • return string
public abstract compile ( $otherOperator )

Provides a compiled version of the constraint for the given operator
The compiled version must be a PHP expression.

Executor of compile version must provide 2 variables:

  • $v = the string version to compare with
  • $b = whether or not the version is a non-comparable branch (starts with "dev-")
  • see
  • example return '!$b && version_compare($v, '1.0', '>')';
  • param int $otherOperator one Constraint::OP_*
  • return string
  • phpstan-param Constraint::OP_* $otherOperator
public abstract getLowerBound ()
public abstract getPrettyString ()
  • return string
public abstract getUpperBound ()
public abstract matches ( Composer\Semver\Constraint\ConstraintInterface $provider )

Checks whether the given constraint intersects in any way with this constraint

public abstract setPrettyString ( $prettyString )
  • param string | null $prettyString
  • return void
© 2022 Bruce Wells
Search Namespaces \ Classes