Copied!

Defines a constraint.

Cloneable Instantiable
Constants
public Composer\Semver\Constraint\Constraint ::OP_EQ = 0
public Composer\Semver\Constraint\Constraint ::OP_GE = 4
public Composer\Semver\Constraint\Constraint ::OP_GT = 3
public Composer\Semver\Constraint\Constraint ::OP_LE = 2
public Composer\Semver\Constraint\Constraint ::OP_LT = 1
public Composer\Semver\Constraint\Constraint ::OP_NE = 5
public Composer\Semver\Constraint\Constraint ::STR_OP_EQ = '=='
public Composer\Semver\Constraint\Constraint ::STR_OP_EQ_ALT = '='
public Composer\Semver\Constraint\Constraint ::STR_OP_GE = '>='
public Composer\Semver\Constraint\Constraint ::STR_OP_GT = '>'
public Composer\Semver\Constraint\Constraint ::STR_OP_LE = '<='
public Composer\Semver\Constraint\Constraint ::STR_OP_LT = '<'
public Composer\Semver\Constraint\Constraint ::STR_OP_NE = '!='
public Composer\Semver\Constraint\Constraint ::STR_OP_NE_ALT = '<>'
Methods
public __construct ( $operator , $version )
 

Sets operator and version to compare with.

  • param string $operator
  • param string $version
  • throws InvalidArgumentException if invalid operator is given.
  • phpstan-param self::STR_OP_* $operator
public __toString () : string
 
  • return string
public compile ( $otherOperator )
 
public getLowerBound ()
 
public getOperator ()
 
  • return string
  • phpstan-return self::STR_OP_*
public static getOperatorConstant ( $operator )
 
  • param string $operator
  • return int
  • phpstan-param self::STR_OP_* $operator
  • phpstan-return self::OP_*
public getPrettyString ()
 
public static getSupportedOperators ()
 

Get all supported comparison operators.

  • return array
  • phpstan-return list
public getUpperBound ()
 
public getVersion ()
 
  • return string
public matches ( Composer\Semver\Constraint\ConstraintInterface $provider )
public matchSpecific ( Composer\Semver\Constraint\Constraint $provider , $compareBranches = false )
 
public setPrettyString ( $prettyString )
 
public versionCompare ( $a , $b , $operator , $compareBranches = false )
 
  • param string $a
  • param string $b
  • param string $operator
  • param bool $compareBranches
  • throws InvalidArgumentException if invalid operator is given.
  • return bool
  • phpstan-param self::STR_OP_* $operator
Properties
protected $lowerBound
protected $operator
 
  • var int
  • phpstan-var self::OP_*
protected $prettyString
 
  • var string | null
protected $upperBound
protected $version
 
  • var string
Properties
private static $transOpInt = [ '==' , '<' , '<=' , '>' , '>=' , '!=' ]
 

Integer to operator translation table.

  • var array
  • phpstan-var array
private static $transOpStr = [ '=' => 0 , '==' => 0 , '<' => 1 , '<=' => 2 , '>' => 3 , '>=' => 4 , '<>' => 5 , '!=' => 5 ]
 

Operator to integer translation table.

  • var array
  • phpstan-var array
Methods
private extractBounds ()
 
  • return void
Properties
private static $transOpInt = [ '==' , '<' , '<=' , '>' , '>=' , '!=' ]
 

Integer to operator translation table.

  • var array
  • phpstan-var array
private static $transOpStr = [ '=' => 0 , '==' => 0 , '<' => 1 , '<=' => 2 , '>' => 3 , '>=' => 4 , '<>' => 5 , '!=' => 5 ]
 

Operator to integer translation table.

  • var array
  • phpstan-var array
Methods
public static getOperatorConstant ( $operator )
 
  • param string $operator
  • return int
  • phpstan-param self::STR_OP_* $operator
  • phpstan-return self::OP_*
public static getSupportedOperators ()
 

Get all supported comparison operators.

  • return array
  • phpstan-return list
© 2022 Bruce Wells
Search Namespaces \ Classes
Configuration