function MultiConstraint::create
Tries to optimize the constraints as much as possible, meaning reducing/collapsing congruent constraints etc. Does not necessarily return a MultiConstraint instance if things can be reduced to a simple constraint
Parameters
ConstraintInterface[] $constraints A set of constraints:
bool $conjunctive Whether the constraints should be treated as conjunctive or disjunctive:
Return value
3 calls to MultiConstraint::create()
- PoolBuilder::markPackageNameForLoading in vendor/
composer/ composer/ src/ Composer/ DependencyResolver/ PoolBuilder.php - UpdateCommand::execute in vendor/
composer/ composer/ src/ Composer/ Command/ UpdateCommand.php - Executes the current command.
- VersionParser::parseConstraints in vendor/
composer/ semver/ src/ VersionParser.php - Parses a constraint string into MultiConstraint and/or Constraint objects.
File
-
vendor/
composer/ semver/ src/ Constraint/ MultiConstraint.php, line 221
Class
- MultiConstraint
- Defines a conjunctive or disjunctive set of constraints.
Namespace
Composer\Semver\ConstraintCode
public static function create(array $constraints, $conjunctive = true) {
if (0 === \count($constraints)) {
return new MatchAllConstraint();
}
if (1 === \count($constraints)) {
return $constraints[0];
}
$optimized = self::optimizeConstraints($constraints, $conjunctive);
if ($optimized !== null) {
list($constraints, $conjunctive) = $optimized;
if (\count($constraints) === 1) {
return $constraints[0];
}
}
return new self($constraints, $conjunctive);
}