function Dependency::getConstraint

Same name in other branches
  1. 9 core/lib/Drupal/Core/Extension/Dependency.php \Drupal\Core\Extension\Dependency::getConstraint()
  2. 8.9.x core/lib/Drupal/Core/Extension/Dependency.php \Drupal\Core\Extension\Dependency::getConstraint()
  3. 11.x core/lib/Drupal/Core/Extension/Dependency.php \Drupal\Core\Extension\Dependency::getConstraint()

Gets the Constraint object.

Return value

\Drupal\Component\Version\Constraint The Constraint object.

File

core/lib/Drupal/Core/Extension/Dependency.php, line 92

Class

Dependency
A value object representing dependency information.

Namespace

Drupal\Core\Extension

Code

protected function getConstraint() {
    if (!$this->constraint) {
        $this->constraint = new Constraint($this->constraintString, \Drupal::CORE_COMPATIBILITY);
    }
    return $this->constraint;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.