private function PrecedingConstraintAwareValidatorTrait::getPrecedingConstraints in Drupal 10
Gets the constraints preceding the given constraint in the current context.
Parameters
\Symfony\Component\Validator\Constraint $needle: The constraint to find the preceding constraints for.
Return value
iterable The preceding constraints.
1 call to PrecedingConstraintAwareValidatorTrait::getPrecedingConstraints()
- PrecedingConstraintAwareValidatorTrait::hasViolationsForPrecedingConstraints in core/
modules/ ckeditor5/ src/ Plugin/ Validation/ Constraint/ PrecedingConstraintAwareValidatorTrait.php - Checks whether any preceding constraints have been violated.
File
- core/
modules/ ckeditor5/ src/ Plugin/ Validation/ Constraint/ PrecedingConstraintAwareValidatorTrait.php, line 48
Class
- PrecedingConstraintAwareValidatorTrait
- A constraint may need preceding constraints to not have been violated.
Namespace
Drupal\ckeditor5\Plugin\Validation\ConstraintCode
private function getPrecedingConstraints(Constraint $needle) : iterable {
assert($this->context instanceof ExecutionContext);
$constraints = $this->context
->getMetadata()
->getConstraints();
if (!in_array($needle, $constraints)) {
throw new \OutOfBoundsException();
}
foreach ($constraints as $constraint) {
if ($constraint != $needle) {
(yield $constraint);
}
}
}