class VersionComparisonOperator
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
@psalm-immutable
Hierarchy
- class \PHPUnit\Util\VersionComparisonOperator
Expanded class hierarchy of VersionComparisonOperator
7 files declare their use of VersionComparisonOperator
- AnnotationParser.php in vendor/
phpunit/ phpunit/ src/ Metadata/ Parser/ AnnotationParser.php - ComparisonRequirement.php in vendor/
phpunit/ phpunit/ src/ Metadata/ Version/ ComparisonRequirement.php - Loader.php in vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Xml/ Loader.php - Registry.php in vendor/
phpunit/ phpunit/ src/ TextUI/ Configuration/ Registry.php - Requirement.php in vendor/
phpunit/ phpunit/ src/ Metadata/ Version/ Requirement.php
File
-
vendor/
phpunit/ phpunit/ src/ Util/ VersionComparisonOperator.php, line 19
Namespace
PHPUnit\UtilView source
final class VersionComparisonOperator {
/**
* @psalm-var '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne'
*/
private readonly string $operator;
/**
* @psalm-param '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne' $operator
*
* @throws InvalidVersionOperatorException
*/
public function __construct(string $operator) {
$this->ensureOperatorIsValid($operator);
$this->operator = $operator;
}
/**
* @psalm-return '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne'
*/
public function asString() : string {
return $this->operator;
}
/**
* @psalm-param '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne' $operator
*
* @throws InvalidVersionOperatorException
*/
private function ensureOperatorIsValid(string $operator) : void {
if (!in_array($operator, [
'<',
'lt',
'<=',
'le',
'>',
'gt',
'>=',
'ge',
'==',
'=',
'eq',
'!=',
'<>',
'ne',
], true)) {
throw new InvalidVersionOperatorException($operator);
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
VersionComparisonOperator::$operator | private | property | @psalm-var '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne' |
VersionComparisonOperator::asString | public | function | @psalm-return '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne' |
VersionComparisonOperator::ensureOperatorIsValid | private | function | @psalm-param '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne' $operator |
VersionComparisonOperator::__construct | public | function | @psalm-param '<'|'lt'|'<='|'le'|'>'|'gt'|'>='|'ge'|'=='|'='|'eq'|'!='|'<>'|'ne' $operator |