Constraint
in package
uses
Iterator, Singles, Validator
This class describes a semantic version constraint. It provides ability to verify whether a version satisfies one or more conditions within a constraint.
Table of Contents
Methods
- __toString() : string
- default() : Constraint
- The default constraint (>=0.0.0).
- isSatisfiedBy() : bool
- Determines whether this constraint is satisfied by a Version or not.
- parse() : Constraint
- Parses a new constraint from the given string.
- parseOrNull() : null|Constraint
- Parses a new constraint from the given string.
Methods
__toString()
public
__toString() : string
Return values
string —the string representation of the constraint
default()
The default constraint (>=0.0.0).
public
static default() : Constraint
Return values
Constraint —the default constraint
isSatisfiedBy()
Determines whether this constraint is satisfied by a Version or not.
public
isSatisfiedBy(Version $version) : bool
Parameters
- $version : Version
-
the version to check
Return values
bool —true when the version satisfies the constraint, otherwise false
parse()
Parses a new constraint from the given string.
public
static parse(string $constraintString) : Constraint
Parameters
- $constraintString : string
-
the string to parse
Tags
Return values
Constraint —the parsed constraint
parseOrNull()
Parses a new constraint from the given string.
public
static parseOrNull(string $constraintString) : null|Constraint
Parameters
- $constraintString : string
-
the string to parse
Return values
null|Constraint —the parsed constraint, or null if the parse fails