function VersionConstraintParser::handleCaretOperator
2 calls to VersionConstraintParser::handleCaretOperator()
- VersionConstraintParser::handleTildeOperator in vendor/
phar-io/ version/ src/ VersionConstraintParser.php - VersionConstraintParser::parse in vendor/
phar-io/ version/ src/ VersionConstraintParser.php
File
-
vendor/
phar-io/ version/ src/ VersionConstraintParser.php, line 90
Class
Namespace
PharIo\VersionCode
private function handleCaretOperator(string $value) : AndVersionConstraintGroup {
$constraintValue = new VersionConstraintValue(\substr($value, 1));
$constraints = [
new GreaterThanOrEqualToVersionConstraint($value, new Version(\substr($value, 1))),
];
if ($constraintValue->getMajor()
->getValue() === 0) {
$constraints[] = new SpecificMajorAndMinorVersionConstraint($value, $constraintValue->getMajor()
->getValue() ?? 0, $constraintValue->getMinor()
->getValue() ?? 0);
}
else {
$constraints[] = new SpecificMajorVersionConstraint($value, $constraintValue->getMajor()
->getValue() ?? 0);
}
return new AndVersionConstraintGroup($value, $constraints);
}