Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MultiConstraint.php

function MultiConstraint::__construct

Parameters

ConstraintInterface[] $constraints A set of constraints:

bool $conjunctive Whether the constraints should be treated as conjunctive or disjunctive:

Throws

\InvalidArgumentException If less than 2 constraints are passed

File

vendor/composer/semver/src/Constraint/MultiConstraint.php, line 46

Class

MultiConstraint
Defines a conjunctive or disjunctive set of constraints.

Namespace

Composer\Semver\Constraint

Code

public function __construct(array $constraints, $conjunctive = true) {
    if (\count($constraints) < 2) {
        throw new \InvalidArgumentException('Must provide at least two constraints for a MultiConstraint. Use ' . 'the regular Constraint class for one constraint only or MatchAllConstraint for none. You may use ' . 'MultiConstraint::create() which optimizes and handles those cases automatically.');
    }
    $this->constraints = $constraints;
    $this->conjunctive = $conjunctive;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal