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

Breadcrumb

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

function AssertingContextualValidator::doValidate

Return value

$this

File

vendor/symfony/validator/Test/ConstraintValidatorTestCase.php, line 502

Class

AssertingContextualValidator
@internal

Namespace

Symfony\Component\Validator\Test

Code

public function doValidate(mixed $value, Constraint|array|null $constraints = null, string|GroupSequence|array|null $groups = null) : static {
    Assert::assertFalse($this->expectNoValidate, 'No validation calls have been expected.');
    if (!isset($this->expectedValidate[++$this->validateCalls])) {
        return $this;
    }
    [
        $expectedValue,
        $expectedGroup,
        $expectedConstraints,
        $violation,
    ] = $this->expectedValidate[$this->validateCalls];
    unset($this->expectedValidate[$this->validateCalls]);
    Assert::assertSame($expectedValue, $value);
    $expectedConstraints($constraints);
    Assert::assertSame($expectedGroup, $groups);
    if (null !== $violation) {
        $this->context
            ->addViolation($violation->getMessage(), $violation->getParameters());
    }
    return $this;
}

API Navigation

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