function Constraint::__construct
Same name in this branch
- 11.1.x vendor/symfony/validator/Constraint.php \Symfony\Component\Validator\Constraint::__construct()
- 11.1.x core/lib/Drupal/Core/Validation/Attribute/Constraint.php \Drupal\Core\Validation\Attribute\Constraint::__construct()
- 11.1.x core/lib/Drupal/Component/Version/Constraint.php \Drupal\Component\Version\Constraint::__construct()
Sets operator and version to compare with.
@phpstan-param self::STR_OP_* $operator
Parameters
string $operator:
string $version:
Throws
\InvalidArgumentException if invalid operator is given.
File
-
vendor/
composer/ semver/ src/ Constraint/ Constraint.php, line 97
Class
- Constraint
- Defines a constraint.
Namespace
Composer\Semver\ConstraintCode
public function __construct($operator, $version) {
if (!isset(self::$transOpStr[$operator])) {
throw new \InvalidArgumentException(sprintf('Invalid operator "%s" given, expected one of: %s', $operator, implode(', ', self::getSupportedOperators())));
}
$this->operator = self::$transOpStr[$operator];
$this->version = $version;
}