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

Breadcrumb

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

function MemberMetadata::checkConstraint

1 call to MemberMetadata::checkConstraint()
MemberMetadata::addConstraint in vendor/symfony/validator/Mapping/MemberMetadata.php
Adds a constraint.

File

vendor/symfony/validator/Mapping/MemberMetadata.php, line 148

Class

MemberMetadata
Stores all metadata needed for validating a class property.

Namespace

Symfony\Component\Validator\Mapping

Code

private function checkConstraint(Constraint $constraint) : void {
    if (!\in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets(), true)) {
        throw new ConstraintDefinitionException(\sprintf('The constraint "%s" cannot be put on properties or getters.', get_debug_type($constraint)));
    }
    if ($constraint instanceof Composite) {
        foreach ($constraint->getNestedConstraints() as $nestedConstraint) {
            $this->checkConstraint($nestedConstraint);
        }
    }
}

API Navigation

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